Alvin wrote:
> Hello all,
>
> I am trying to display the coordinates of the mouse during a FL_MOVE event.
> But the problem is, my widget never sees the FL_MOVE event!?
>
> I have a widget that extends Fl_Scroll. Basically this widget allows the
> view to be scrolled my dragging the contents around with the mouse.
>
> What I would like to do is for one of the widgets inside my Fl_Scroll to act
> on the FL_MOVE event (show the coords of the mouse). However, the widget
> never receives a FL_MOVE event. The widget does get, FL_PUSH, FL_ENTER,
> FL_LEAVE...just not FL_MOVE.
>
> I tried catching a FL_MOVE event in my FL_Scroll before doing anything with
> the event (i.e. passing it up to Fl_Scroll, etc.) but it seams it doesn't
> get the FL_MOVE event either.
>
> I tried returning 1 for FL_ENTER but that doesn't seem change anything.
>
> Anyone have any ideas? Has a similar issue happened to anyone else? I
> suspect the solution is trivial, but I just can't see it for some reason.
The following is a shortened handle() method of a working program.
I know for sure that the widget gets FL_DRAG events, but I'm not sure
that it would also get FL_MOVE events.
Compare this to your handle() method. Maybe it has something to do with
input FOCUS. I'm not sure, why I there is a take_focus() call on FL_PUSH,
maybe that's the point.
I'd try first to test the behavior, if your widget has the focus.
Sorry, I can't give you more info, because I don't know myself. Maybe
you should look into the FLTK sources.
Albrecht
int DBox::handle(int event) {
switch (event) {
case FL_FOCUS:
case FL_UNFOCUS:
return 1;
case FL_KEYBOARD:
if (...) {
redraw();
return 1;
}
break;
case FL_ENTER:
fl_cursor(FL_CURSOR_ARROW);
return 1;
break;
case FL_LEAVE:
fl_cursor(FL_CURSOR_DEFAULT);
return 1;
break;
case FL_PUSH:
take_focus();
return 1;
break;
case FL_RELEASE:
; do something
redraw();
return 1;
case FL_MOVE:
return 1;
break;
case FL_DRAG:
if (Fl::event_inside(this) && ...) {
redraw();
return 1;
}
else
return 0;
break;
default:
break;
}
return Fl_Box::handle(event);
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk