Re: Displaying intermediate button images.



Rich Burridge wrote:

Hi Tristan,

Can I ask a favour please? Could you adjust the reve_sleep() routine in the
attached small program to use a g_timeout_add() to do the pausing?


You seemed to have ignored the revised small attached program that I
sent you and gone back to my first version. Could you show me how to
do this with the program attached below please?

No I did not, I based it on the code you attatched in your private
post, note that the first thing I did was to remove the reve_timeout()
function.

As I mentioned to you and Greg offline, I've slightly adjusted the code in
on_click() to better reflect the larger program. In other words, this
is a small part of a larger program that does the toggling of the button
(and other similar actions) in the middle of other code. I did not see a
simple, elegant way to easily to the right thing with g_timeout_add under
that scenerio.

Yes,
   I see that; that doesnt mean that you cant adjust your code
to be event based; the select() call in reve_sleep() should
be the select() call in g_poll(), envoked implicitly be the GMainLoop
in gmain.c, in other words, dont sleep(), instead: return.

The program I uploaded does this and should at least give you an
idea of how to implement that in your larger application.

If you need to resume some other execution when your buttons
finish flickering; then you can either call that code segment
directly from your timeout handler before returning FALSE,
or register an idle handler before returning FALSE.

Cheers,
                                  -Tristan

Note that you can always go about the problem in a backwards
manner, you could use nested GMainLoops; like gtk_dialog_run
does; IMO this is just error prone and I wont recommend it;
I'm not sure it would be all that easy to get it working either.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]