Stan wrote:

>> Greg Ercolano wrote:
>>> ..I think you'll see their x/y positions continue moving
>>> around such that they cross over each other..
>>      You can probably see the behavior more clearly
>>      if you change these lines in your program:
>>
>>
>>      BEFORE: Fl_Double_Window win(400, 200);
>>       AFTER: Fl_Double_Window win(400, 800);
>>
>>      BEFORE: MyBox* bx2 = new MyBox(bx1->x() + bx1->w(), bx1->y(), 150, 20);
>>       AFTER: MyBox* bx2 = new MyBox(bx1->x() + bx1->w(), bx1->y()+10, 150, 
>> 20);
> 
> 
> Ah, yes.  My brain may be more addled that I thought.
> Thanks much Greg, that helps a lot.

... and now you _can_ see the difference if you change your resize 
method and use init_sizes()  :-)

     void resize(int x, int y, int w, int h)
     { Fl_Box::resize(x, y, std::max(w, 100), h);
       parent()->init_sizes();  // add init_sizes() here !
     }

If you don't use init_sizes, then the resizing can be reverted as long 
as you like, because it is always calculated from the initial widget 
positions.

If you add init_sizes(), then the modified positions and sizes become 
the starting points for the following resizing, and so on ...

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

Reply via email to