> If I understainded this, you would like to check events 'outside' your
> window ?
>
> Fltk can't handle events outside it's own main window out
> of the box

If you have an Fl_Choice widget, and pop up its menu, you
can dismiss the menu sub-window by clicking anywhere at
all, so it seems fltk can handle it somehow.

Here's another example.  Without the sub-window, grab()
makes all the events visible, as expected. Compare it to
the original.

#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <iostream>

class SubWindow : public Fl_Double_Window {
public:
        SubWindow(int w, int h, char const* label = 0)
                : Fl_Double_Window(w, h, label)
        {
                end();
        }

        int handle(int event)
        {
                if(event == FL_KEYDOWN && Fl::event_key() == FL_Escape) {
                        exit(0);
                }
                if(event == FL_PUSH) {
                        std::cout << "PUSH\n";
                }
                return Fl_Window::handle(event);
        }
};

int main()
{
        SubWindow sub(200, 200, "Sub");
        sub.show();
        Fl::grab(&sub);
        return Fl::run();
}


_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to