Re: gtk_button




i am incrementing count just using a for loop, and what ever the
value variable is having will be displayed in gtk_entry. like that
i can able to display the increment value in gtk_entry. 

First of all, why on earth are you using a for loop!?  Either user a timeout or an idle, to increment the 
count.  And when the button is clicked, stop it.

Any loop that takes more than a fraction of a second to run is bad, evil, and probably just plain wrong.  GTK 
is an event driven toolkit.


now i have a gtk_button, when i press the button it has to pass the
signal to the gtk_entry and the count has to be stopped. once the
button pressed value in gtk_entry not supposed to increase(vary).

Store the id returned when you create the timeout or idler, and use it in the button callback to remove the 
event so it doesn't get called anymore.


in what way i can proceed for it.

Always keep in mind that GTK is an event driven toolkit, surrounding an engine that creates events.  Any time 
your program needs to sit and wait for anything, you're probably doing something wrong.  And if your program 
is doing something non-event-driven (like sitting in a for loop), and expecting to do something when 
something event-ish happens (like clicking on a button), that's bad also -- mixing event driven and 
non-event-driven tequniques is bound to cause trouble.


Fredderic

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!





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