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

Re: Dynamically changing menus




On Fri, 4 Jun 1999, Richard Tew wrote:
> and you can tell that the item is disabled when you look.  I know I could
> just make the item do nothing, but a visual effect that showed that the
> item was disabled would be nice.  I can't see anything like this in the
> source, any ideas? 
>

gtk_widget_set_sensitive(menuitem, FALSE);
 
> > You need to gtk_widget_ref() the menu item before you remove it, or it
> > will be destroyed when its parent container unreferences it. After you
> > re-add the item, unref() it again.
> 
> Ahh, I worked this bit out for several things, but I was not sure on the
> unreffing bit.  Does unreffing actually make a difference?
> 
> The reason I ask this is cause if I do not ref the submenu, the second
> time I switch to the page it seg faults as the widget was destroyed.  BUT,
> if I ref it once when its created, I never have a problem no matter how
> many times I switch pages.
> 

If you increase the reference count but never do the corresponding
decrease, then the widget won't ever be freed, so you'll leak memory. But
it won't crash.

Havoc




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