Re: Using the motion-notify-event




On Mar 3, 2005, at 7:56 AM, Ari Jolma wrote:

I have a window, where I have a ScrolledWindow, where I have an EventBox, where I have an image. I get the motion-notify-event only when I move the mouse with button pressed. How do I get the event without having to press the button?

I need the press-button-move event also for panning the image, but I expected it to be the drag-begin drag-end events, which I did not yet get fired in any case.

it's really just a gtk+ question.  the same thing happens in C.  :-P

my $event_box = Gtk2::EventBox->new;
$event_box->add($image);
$event_box->signal_connect(motion_notify_event => \&motion_notify);

by default, GtkEventBox does not ask for motion-notify-events. when you drag with the mouse button down, gdk automatically grabs the pointer and you get the motion notifies (maybe that's X, i'm not sure), until you let the button up, at which point it ungrabs. if you want motion notify at all times, you need to tell the widget to ask X for those events.

  $event_box->add_events ('pointer-motion-mask');


--
The door is locked. I tried to open it, but the lock is harder to pick than a broken nose.
  -- Sensei, on 'I, Ninja'




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