Lukasz wrote:
> but if I declare even empty
> (and always returning 0) handle() for window, box doesn't get _any_ event.

        Yes, that's by design; if you make a YourWindow::handle() method,
        you're supposed to call Fl_Window::handle(e) as part of your handle()
        code, to ensure the window can handle and propagate events down to
        its children.

        By not implementing that, you're short circuiting event delivery
        down to the children.

        So at very least, you should have something like:

YourWindow::handle(int e) {
    int ret = Fl_Window::handle(e);
    // your stuff here
    return(ret);
}

        If you want to receive MOVE events, be sure to return(1)
        in response to FL_ENTER events, eg:

YourWindow::handle(int e) {
    int ret = Fl_Window::handle(e);
    switch ( e ) {
        case FL_ENTER: ret = 1; break;          // we want FL_MOVE events
        default: break;
    }
    return(ret);
}

        As an example of an app that wants FL_MOVE events to show the
        x/y position of the mouse, see: 
http://seriss.com/people/erco/fltk/#DrawCoords

> So, what's the right way to have actually multiple handles()? 

        You don't have to do anything special, other than to be sure
        to call the derived class's handle() method, or you'll starve
        the base widget of all events. And in the case of a window or group,
        that would starve children of event propagation as well.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to