Re: dynamically changing the text of a GtkMenuItem



Paul Davis <pbd Op Net> writes:
> i have a menu which as 2 item that potentially need updating every
> time it is displayed (its a submenu of a menubar). at the moment, i
> connect to the map_event, remove (and delete) all the items, recreate
> new items, and return FALSE. this works, but after a couple of rounds
> of this, i start to messages about ref counts not being > 0, and
> various other issues that make it clear that something has gone wrong.
> 
> what would be the preferred way of handling this?
> 

I think "map" might be better than "map_event", since map_event
happens async after the menu has already been shown. Another
possibility is "activate" or maybe focus_in_event on the menu item
that has the to-be-filled menu as submenu. Would have to experiment.

GTK should really have a signal that's explicitly for this purpose,
though.

Havoc



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