[Glade-users] how to have a iteration untill a button is released?

On Sun, 2007-01-21 at 23:32 +0100, Koen Lekkerkerker wrote:
Hi everybody, i still didnt find out how to fix the problem which i
mailed about a while ago. It is desribed beneath. I really tried hard
and an awfull lot, but nothing worked. Though i am sure its possible.
Could someone please help me with it because its very important for a
important school project...
This is what i wrote last time:

"I want this after button is pressed: 1. first i want some code to be
executed, 2. then i want to periodically increment a value x untill the
button is released 3. and after that i would like to execute some other
I guess only the iteration part is the problem. For this i thought about
an iteration with a usleep(T) to make it being incremted every T and to
make it stop when a boolean which checks if the button is clicked (or
actually in my case: pressed) returns FALSE. But i couldnt find a
boolean for this. I did found something about
gtk_get_current_event_state () and gtk_get_current_event() though i
didnt get them to work (maybe i just do not understand them well)... So
does anybody know how to keep an iteration going untill a button is

In the button-press signal handler call g_timeout_add() to add a
function to be called at regular intervals. (Make sure you store the
returned timeout id as you'll need it to remove the timeout function.)

In the button-release handler call g_source_remove() to remove your
timeout, using its id. (You should also remove it if your window is
closed or destroyed.)


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