Re: GtkDrawingArea and mouse clicks



Jeff Abrahamson wrote:

I have a Glade project that declares a GtkDrawingArea:

     <child>
	<widget class="GtkDrawingArea" id="network_map">
	  <property name="width_request">600</property>
	  <property name="height_request">200</property>
	  <property name="visible">True</property>
	  <property name="can_default">True</property>
	  <property name="has_default">True</property>
	  <property name="can_focus">True</property>
	  <property name="has_focus">True</property>
	  <property name="extension_events">GDK_EXTENSION_EVENTS_ALL</property>
	  <signal name="button_release_event" handler="on_network_map_button_release_event" last_modification_time="Sun, 15 Feb 2004 18:40:17 GMT"/>
	  <signal name="button_press_event" handler="on_network_map_button_press_event" last_modification_time="Sun, 15 Feb 2004 18:48:36 GMT"/>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">True</property>
	  <property name="fill">True</property>
	</packing>
     </child>

But my callback functions don't get called when I click the mouse in
the GtkDrawingArea.

Other callbacks (for different objects) are working, so I guess I'm
not totally confused, just a little.

Any suggestions what to try next?
You have a zero events mask on your drawing area, GTK+ just doesnt call your handlers. You should put GDK_BUTTON_PRESS_MASK and GDK_BUTTON_RELEASE_MASK to "events" field (Properties dialog, Common tab, Events entry in glade). GTK+ analog gtk_widget_add_events() and gtk_widget_set_events():
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-set-events
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-add-events

   Olexiy





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