Brian J. Tarricone
Tue, 23 Feb 2010 16:22:50 -0800
So I have a bit of a weird request. I'm creating a menu based on several merged UI descriptions at runtime, using GtkUIManager. This part works great.
The problem is that our user experience guys want a sort of toggle-button-like radio selector at the top of the menu (this will be for a touchscreen device). So the first "menu item" will actually be three buttons arranged horizontally. I created a simple GtkMenuItem subclass that adds a GtkHBox to itself with 3 GtkToggleButtons, plus some logic to make sure only one is selected at a time. I build the GtkMenu with GtkUIManager, and add my custom menu item to the top. First problem: I don't want the big prelight when the mouse moves over it. Fine, I just override GtkWidget::expose_event and GtkItem::select in my menu item subclass. But now the three buttons don't work. I don't get a prelight (somewhat important because our device will have a stylus that supports proximity), and clicking on them does nothing. I suspect it has to do with how GtkMenu does its grabs. However, if I connect to motion-notify on my GtkMenuItem subclass, I do get motion events -- actually I seem to get *two* motion events for each mouse move over any of the buttons -- one with coords relative to the button, the other with coords relative to the menu item -- the odd thing is that both of these events are delivered to the menu item (or maybe that's not odd, given the grab?). Anyway, I'm a bit stumped at this point. Any pointers would be appreciated. I'd rather not have to write my own GtkMenuShell subclass, but if people here think that's the best (or least-worst) way to go, I'll do it. Thanks, Brian _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list