Re: [gtk-list] Pop-up menus and mouse button events



>From: Constantine Vetoshev <con@consela.com>

>I have a question about how pop-up menus could be made to work in
>GTK+. Basically, I want to bind a pop-up menu to the third mouse
>button. I want it to come up anywhere within the window of the
>application. This means I have to attach a button_press_event to the
>window. Then I'd have a callback that would bring up the menu.
>
>This doesn't work because button_press_events are apparently
>ignored. I wrote a small program that does nothing but spit out what
>happens to it. There's nothing there that has an GdkEvent type
>GDK_BUTTON_PRESS, GDK_2BUTTON_PRESS, GDK_3BUTTON_PRESS, or
>GDK_BUTTON_RELEASE.
>
>The examples directory has a menu example program that shows pop-up
>menus. However, this program brings up a pop-up menu when a GtkButton 
is
>clicked. As I said, I want the menus to come up anywhere in the window
>(specifically, over a GdkImage).
>
>Can this be done?

I am not sure about it but you can try it...

Rather than "button_press_event", try connecting your signal handler to 
"event". It should give you all events and then you know how to go from 
there? ( event->type... gdk_window_get_pointer() ... etc)

Hope this helps
-kaq

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com



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