Re: [gtk-list] Re: Setting check menu item state without triggering
- From: Federico Mena Quintero <federico nuclecu unam mx>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Setting check menu item state without triggering
- Date: Sun, 9 May 1999 02:03:36 -0400
> > I have several check menu items in a menu and want to set their state
> > without triggering the menu item's signal function. Normally, the state is
> > changed when the user selects the item which all works well. Sometimes, such
> > as when loading preferences, I want to check and uncheck these items to
> > match the preferences. I tried the code in Developing Linux Applications
> > (Synchronizing Toolbar and Menu Items, starting page 96) but this results in
> > signals being sent.
> >
>
> Yeah, there is no nice way to avoid this. The easiest thing to do is keep
> a boolean flag somewhere, and if TRUE have your signal handlers return
> without doing anything.
It may be more convenient to just block the signal while you are
changing the state of the menu items. You can use
gtk_signal_handler_block_*() and gtk_signal_handler_unblock_*() for
this.
You would do something like
gtk_signal_handler_block_by_data (GTK_OBJECT (my_menu_item), my_data);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (my_menu_item), TRUE);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (my_menu_item), my_data);
Federico
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]