Re: [gtk-list] Re: Disabling callbacks - Further explanation



Thus spoke K. M. Hawarden-Ogata
> For example: suppose I have a pair of radio button which control whether
> data is saved to an external file or not. The user can select "on" with the
> mouse OR type "save on" in the command line. Either one of these actions
> should result in the "On" button being depressed, the "Off" button being
> undepressed and the 'save' variable being set to 1.
> 
> Unfortunately, when the screen is redrawn, and the button is toggled,
> another signal is emitted, (toggled) and I don't want this to happen.

You need to save some state stating which way the callback is being called.
One of way of doing this is to make a single function that does the work,
but that is not called directly by the callbacks.  Instead, there are two 
callback routines, each of which calls the same routine but passing in a flag 
so that one routine knows who's calling it.  Then you block the other 
callback from happening with gtk_signal_handler_block().

-- 
Michael J. Hammel           |
The Graphics Muse           | Tell me what you need, and I'll tell you how to
mjhammel@graphics-muse.org  | get along without it. -- Dilbert
http://www.graphics-muse.org



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