> Use this in your widget's handle() method to accept/reject events > like FL_PUSH/FL_RELEASE, and detect mouse movement over the circular > region for events like FL_MOVE (e.g. if you want it to 'light up' > when the mouse is over it)
OK, but ones I accepted the FL_ENTER event I could not dispatch events to other outside widgets if any event leave my "accepted region". I did the following example: Creating a canvas and put a blue big box on it. Over the blue box I put a smaller red one. My "accepted region" is a bit smaller then the widgets outer rectangle. If I move my mouse on a horizontal line over the widgets I see: First I get a FL_ENTER, I don't accept it in my "non active region". In response I get an FL_LEAVE. After the mouse goes inside my "accepted region" I accept the FL_ENTER. After this, any mouse move will give me an FL_MOVE event. OK, thats fine. If I now move inside the red box to the "not accepted region" I will answer to FL_ENTER with 0. After that, the blue box get the FL_ENTER again. OK, so I have to generate FL_MOVE events on my own for the blue box. Thats not nice but I could handle that. The mouse moves now to the "accepted region" of the red box, I accept the FL_ENTER and receive FL_MOVE for any following mouse moves. OK, thats what I expect. 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. 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? I add my example code: #include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Box.H> #include <iostream> using namespace std; class MyMonitorBox: public Fl_Box { private: const char *name; bool event_inside( ) { int lx=Fl::event_x(); int ly=Fl::event_y(); return ( ( lx >= x()+20 ) && ( lx <= x()+w()-20) && ( ly >= y()+20 ) && ( ly <= y()+h()-20 ) ); } public: MyMonitorBox( int X,int Y,int W,int H,const char*L=0) : Fl_Box( X,Y,W,H,L ), name(L) { } int handle(int e) { cout << "MonitorBox " << name << " Event " << e << endl; switch (e) { case FL_ENTER: case FL_MOVE: { int lx=Fl::event_x(); int ly=Fl::event_y(); if ( event_inside()) { cout << name << "is in at " << lx << ":" <<ly << endl; Fl_Box::handle(e); return 1; } else { cout << name << " is out at " << lx << ":" << ly <<endl; if ( e == FL_MOVE ) { return Fl_Box::handle( FL_LEAVE ); } return 0; } } break; default: return Fl_Box::handle(e); } } }; int main() { Fl_Window win(400,400, "Test1"); MyMonitorBox mb1(100,100,200,200, "Blue"); MyMonitorBox mb2(150,150,50,50, "Red"); mb1.color(FL_BLUE); mb1.box( FL_BORDER_BOX ); mb2.color(FL_RED); mb2.box( FL_BORDER_BOX ); win.show(); return (Fl::run()); } _______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk