On Apr 11, 2007, at 5:31 PM, Stan wrote:

> It occurred to me to have a Widget that put a box around
> itself.  In the program below, if the line marked #2
> is enabled, it works as I expected, but if line #1 is
> used instead, the button is invisible.  Can anyone offer
> any insight?

In FLTK, *any* widget can have a box around itself by simply calling  
myWidget->box(FL_SOME_BOXTYPE); . The Fl_Box widget is simply a  
widget with no additional function than having a box and a label. It  
does not handle any events that occur within the area of the box.

You code is wrong because you draw your button under the box. That  
way, the button gets drawn first, then the box (which can be a frame  
only, but also have a background), erasing you button again. The sme  
overlapping happens to any event that may got to the box.

The solution is simple: never overlap widgets. Instead, put the  
Button inside a group, and give the group the box style that you  
like. The group will correctly draw your button and forward all events.

----
http://robowerk.com/


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

Reply via email to