On 06/05/11 15:28, anon wrote:
> I have to LOL a bit here on what I wrote about resize() (bug) as I include
> it's definition here:
>
> void Fl_Widget::resize(int X, int Y, int W, int H) {
> x_ = X; y_ = Y; w_ = W; h_ = H;
> }
>
> :D
> Ok, my mind is still wandering and wondering :(
Yes, Fl_Widget is the lowest class in the FLTK widget
chain, so that's all it would do.
But unless your class is deriving from Fl_Widget,
you wouldn't use that as an example.
You're probably deriving from an Fl_Group or Fl_Window,
which has to manage children as well as itself.
And like in real life, when children are involved,
things are more complicated.
And I have to assume in your case your class has children,
since you mention two or more boxes that you're changing
the size of, so they must be children to your parenting
group widget that is handling their resizing.
As an example; if you make a widget called YourWidget
that derives from Fl_Window, and it has two children,
box1 and box2, YourWidget::resize() should look something
like:
YourWidget::resize(int X, int Y, int W, int H) {
box1->resize(...); // whatever logic you want to resize this
specific widget
box2->resize(...); // whatever logic you want to resize this
specific widget
init_sizes(); // tell the base class to recalculate the
changes
}
If YourWidget has more than just two children, eg.
a menu bar, some buttons, as well as the two boxes,
then you should really do this:
YourWidget::resize(int X, int Y, int W, int H) {
Fl_Window::resize(X,Y,W,H); // let subclass resize all children
box1->resize(...); // make your specific changes after that
box2->resize(...); // "" ""
init_sizes(); // tell the base class to recalculate the
changes
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk