Method to query toggle button state?



Hi.  Appologies if this has been discussed before but the archive server 
appears to be dead...

Are there any plans to add a gtk_toggle_button_get_toggle_state() for
toggle buttons and/or radio buttons?  Such a function would (obviously)
return the toggle state of the specified button to the caller.  The
current library design seems to require that the programmer create a callback
function to catch click events.

There are situations where one would need to be notified of every click
but for a mundane dialog, it's inefficient and leads to messy code:

For instance, suppose we're implementing a dialog that consists of a dozen
or so radio buttons and toggle buttons.  So far as I can tell, the programmer 
must insert a callback to catch the click event on each button and 
keep track of the overall state in real time, perhaps in a temporary
state settings structure.  If the user cancels from the dialog, the temporary
settings are simply thrown away; if the user clicks "Okay" the
temporary settings are copied into the "real" settings.  Each time the user
clicks on a button, a callback must be called to update the temporary
settings.  A purist could successfully argue that this is a waste of
cpu resource - only the final state is of any interest.

Contrast this with the scenario if a xxx_get_yyy_state() function existed:

The programmer creates the dialog consisting of various radio and toggle
buttons.  The user clicks and clicks and clicks...all the while the
program itself doesn't have to do anything.  If the user cancels,
the dialog simply closes.  No wasted work.  If the user selects "Okay",
then and only then does the program query the state of each button.
Again...no wasted work.  No need to maintain temporary state settings.
The dialog routine just became an order of magnitude simpler.

It's easy enough for the program itself to extract the info from the toggle
button widgets but we all know the future problems that tends to cause.
Is there a reason why GTK doesn't include such a function?

Jimmie


-- 
Jimmie Mayfield  
http://www.sackheads.org/mayfield       email: mayfield@sackheads.org
My mail provider does not welcome UCE -- http://www.sackheads.org/uce



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