On 10/30/12 02:25, Klaus Rudolph wrote:
> But if I now move to the "not accepted region" of the red box, I could
> not tell fltk that I am out of my accepted region.
Probably someone else who's done this before should weigh in;
I can only guess as I haven't done it, and it would take a bit
of probing around to figure it out.
My understanding of the FLTK event delivery mechanism is FLTK
knows where the mouse is, and it walks the widget hierarchy to
see if the mouse has moved across a widget boundary (xywh), and
calls that widget's handle() method with FL_ENTER|FL_LEAVE,
keeps track of the response to FL_ENTER to manage delivering
FL_MOVE events, etc.
Because you kinda want to define an arbitrary region of sensitivity
(instead of FLTK's xywh behavior), you kinda have to take over the
above process once inside your widget, so that you can handle
making the event delivery work properly.
Which means being aware of these techniques:
o Getting the mouse position
o Walking the widget hierarchy (eg. walking down
window()->child()..)
o Calling the handle() methods of the appropriate widgets
> QUESTION: How to tell fltk that the mouse now leaves my accepted
> region??? I send manually a FL_LEAVE to the Fl_Box, I returned 0 or 1 in
> the tests but never got an event to the underlaying blue box. What can I do?
To do that involves calling the blue box's handle() method
(presumably from within the red box's code) and send FL_ENTER
to the blue box.
It's not really FLTK you want to tell so much as you want to 'tell'
the widget.
Much of the mechanics of event handling is actually handled by the
widgets themselves.
I'm not sure how much state information FLTK maintains, but focus
is surely one of them, so you probably have to manage Fl::focus()
at least, so that focus can shift to the blue box (if it has a concept
of focus). To do that, you'd again emulate what FLTK does by sending
an FL_FOCUS event to it and see if it accepts it, and if so, adjust
Fl::focus().
Sorry I don't have time to make an example to see if any of this
works, but I think you have to look closely at what FLTK internally
does for event delivery, or at very least the docs on FLTK's event
delivery to emulate the parts you need.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk