Re: [gtk-list] labels and events
- From: owt1 cornell edu
- To: gtk-list redhat com
- Subject: Re: [gtk-list] labels and events
- Date: Fri, 11 Jul 1997 12:30:55 -0400 (EDT)
On Fri, 11 Jul 1997, Hoek wrote:
> Current window is X
>
> So, can I use a label for X and connect that to an event handler, so that
> when I click on X a menu will pop up? So far I haven't been able to
> make a label respond to anything. Or is it possible to create a menu_bar
> without a border of any kind?
It isn't possible to connect a event handler to a label, since labels
don't have associated X windows. So you'll need to stick your label
inside another widget, and connect to button press events on that
widget. One possibility, if I remember corrrectly, is the Viewport
widget. (Boxes, the obvious choice, also don't have windows.)
Then do something like
gtk_widget_set_events(mywidget,GDK_BUTTON_PRESS_MASK);
gtk_signal_connect(GTK_OBJECT(mywidget,"button_press_event",
button_press_callback, NULL);
where
static gint
button_press_callback(GtkWidget mywidget, GdkEventButton *event)
{
gtk_menu_popup(GTK_MENU(mymenu),NULL,NULL,NULL,NULL,
event->button);
}
(This is ofcourse, untested)
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]