Re: [gtk-list] Button events from Preview widget



I'm afraid I can't help with the Gtk--,
but in "raw C GTK" you would need to
call gtk_widget_add_events() with
 GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
to  request that button_press_event and button_release_event
be available to your preview widget.   (Don't quote me, I'm doing this from
memory)....  The signals are available to descendants of GtkWidgets,
but not all are explicitly caught.

Hope that helps.
Donna


----- Original Message -----
From: Robert A. Knop Jr. <rknop@lilys.lbl.gov>
To: <gtk-list@redhat.com>
Sent: Tuesday, February 08, 2000 6:26 PM
Subject: [gtk-list] Button events from Preview widget


> I'm trying to get button events out of a GTK Preview widget; as it is
> derived from Widget, and since Widget lists button_press and
> button_release events, I assume that I could use such events from a
> Preview widget.  The sparse documentation online ( ;) ) didn't give me any
> answers as to what was going wrong.
>
> I'm using Gtk--, but I presume that the principle is the same as using raw
> C GTK.
>
> The code which creates the widget includes the following:
>
>   preview=new Gtk_Preview(GTK_PREVIEW_GRAYSCALE);
>   preview->size(600,600);
>   connect_to_method(preview->button_press_event,this,&previewPress);
>   connect_to_method(preview->button_release_event,this,&previewRelease);
>   pack_start(*preview,FALSE,FALSE,4);
>   preview->show();
>
>
> The raw "pack_start" call is because my class is derived from the HBox
> class.  The widget is created and appears.  However, my two callbacks (the
> methods "previewPress" and "previewRelease") never get called, even when I
> try clicking within the widget.
>
> Can anybody suggest what I've neglected here?
>
> Thanks,
>
> -Rob Knop
> rknop@lbl.gov
>
>
>
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com <
/dev/null
>
>



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