Re: [gtk-list] Accessing state of menu items



On Sat, 27 Mar 1999, Allin Cottrell wrote:

> I have created a menu consisting of <CheckItem>s using
> ItemFactory.  I would now like to be able to write code
> conditional on the status (active or not) of those items, and
> also code that sets the status of those items (e.g. conditional
> on what is found on reading an rc file).  In the gtk docs I have
> found conditional code somewhat similar to what I have in mind,
> but for "stand-alone" toggle buttons, and I don't see how to
> translate it for toggleable menu items.  
> 
> Question: Am I missing something in the documentation?  Or could
> anyone point me towards additional docs or code samples that
> might clarify this?  Thanks.

retrive the menu items from the menu factory through their paths:

GtkWidget *item = gtk_item_factory_get_item (factory, "/File/Toggle");

and set their state:

g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (item));

gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), active);

> 
> -- 
> Allin Cottrell
> Department of Economics
> Wake Forest University, NC
> 

---
ciaoTJ



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