Re: catching messages

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

 



On Sun, 2006-01-08 at 18:00 -0500, Travis Miller wrote:
> This is probably a dumb question (but here goes anyway). I have been
> playing with gtk+ for awhile now, but recently I wanted to try
> something more graphical.  Basicly I want to be able to read in some
> data and display it graphically.  I wanted to add handlers that would
> allow me to drag the view port around (using the mouse). 
> 
> So basicly I used Glade to create the UI.  So I have a gnome window
> (with menu bar and button tool bar and all).  ANd there are lots of
> containers (VBox's and HBox's) and doen this chain is a
> GtkDrawingArea.  I used Glade to add handlers for various events (like
> motion_notift_event, and enter_notify_event etc.).  None of these
> handlers ever seem to get called however.  What is causing this?  Do I
> have to do something more?  Are the containers preventing the event
> from trickling down to the GtkDrawingArea?

You need to ask for these events to be enabled, have a look at
gtk_widget_set_events () or gtk_widget_add_events().

There should be an example of this in the gtk-demo (the Drawing Area
test).  Below is a snippet from that code:

      /* Ask to receive events the drawing area doesn't normally
       * subscribe to
       */
      gtk_widget_set_events (da, gtk_widget_get_events (da)
			     | GDK_LEAVE_NOTIFY_MASK
			     | GDK_BUTTON_PRESS_MASK
			     | GDK_POINTER_MOTION_MASK
			     | GDK_POINTER_MOTION_HINT_MASK);

-- 
Regards,
Martyn

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux