Re: Destroying popup menus (possible bug)
- From: Owen Taylor <owt1 cornell edu>
- To: "GTK List" <gtk-list redhat com>
- Subject: Re: Destroying popup menus (possible bug)
- Date: 23 Mar 1998 11:43:31 -0500
"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]