Re: [gtkmm] Ruler position indicator



Am Fre, 2003-05-09 um 07.43 schrieb Gregory P. Bayard:
> I am unable to connect the ruler position indicator to
> motion events in a Gtk::DrawingArea.  There is a large
> amount of example source code on the internet that no longer
> compiles with gtkmm-2.0.  The code on the net shows,
> 
> drawing_area.motion_notify_event.connect(horiz_ruler.motion_notify_event.slot());
> 
> Neither the Gtk::DrawingArea nor the Gtk::HRuler have a
> motion_notify_event.  The new versions of the objects have
> signal_motion_notify_event() and on_motion_notify_event()
> methods.  Intuitively I figured the following would work,
> 
> drawing_area.signal_motion_notify_event.connect(horiz_ruler.on_motion_notify_event.slot());
> 
> Sadly, it does not work, as on_motion_notify_event does not
> provide a slot().  Does anyone have any idea how to move the
> indicator with the mouse on a ruler in gtkmm-2.0?
> 
the simplest and fastest (i think) is to overwrite the original event
handler. put

virtual bool on_motion_notify_event (GdkEventMotion* event);

in you header and than you can use it with

bool
yourDrawingArea::on_motion_notify_event (GdkEventMotion* event)
{
  do_things ();
  return true;
}

here it is not necessary to call the original handler with

Gtk::DrawingArea::on_motion_notify_event (event);

like for the realize event, cause the drawing area dosn't uses the
motion events on it's own.

cheers
detlef

> Thanks,
> Gregory Bayard
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list




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