Re: Destroying popup menus (possible bug)




"Damon Chaplin" <DAChaplin@email.msn.com> writes:

> Hi,
> 
> This may be a bug.
> 
> I'm using context-sensitive popup menus, which are created on the fly
> and are to be deleted as soon as they pop down.
> 
> To delete the menu I added a 'deactivate' signal to it:
> 
>   gtk_signal_connect_object (GTK_OBJECT (menu), "deactivate",
>         GTK_SIGNAL_FUNC(gtk_widget_destroy),
>         GTK_OBJECT(menu));
> 
> However, if any menu items are selected, the menu disappears but the
> menuitem 'activate' signal handlers are not called. I assume the
> problem is that the menu is destroyed before the handler is called.

Yep. More exactly, the problem is that your MenuItems are getting
destroyed along with the menu.
 
> Should it be changed so that menuitem 'activate' handlers are called
> before the menu 'deactivate' handler?

I don't think so. What if the activate handler takes a long time
to execute? The window has to be hidden first. I would say that
you should just destroy the menu in your "activate" handlers.
If this isn't convenient, you can even attach a second "activate"
handler to each menu item that only  does that.
 
Regards,
                                        Owen



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