David Lopez wrote: > Hi everybody. > > How can I handle FL_PUSH events when there are several overlapped widgets? > Do I need to handle the event in the container (e.g. Fl_Window) and traverse > the child list, checking the coordinates, or there is any better way to do it? > Is there any way to send a widget "background/foreground" so one of the > overlapped widgets can receive the FL_PUSH event?
Normally it is recommended not to have overlapping widgets, however if you are careful you can have them overlapping too (I am guilty here too), although you might need to override some handle/draw methods. You have to have in mind that: 1) The widgets are drawn with the order within the parent group array - so arrange them that way or create the top widgets *after* the bottom ones. 2) The widgets send events in reversed order (unfortunately with exception of FL_FOCUS) which is consistent with (1) so that top widgets get the event first. But if the widget is not interested in the event, the event can be sent to the background widget later. In your case to avoid sending FL_PUSH event to the background one for invisible part assure that the handle() of your top widget always returns 1 if the click is *inside* the top widget. 3) You have to assure that if the background widget needs redraw, you should call redraw() also for top widget. The easiest way is (when necessary) to call redraw() on parent group encapsulating all the widgets R. _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

