On 06/14/11 23:49, Evan Laforge wrote:
> On Tue, Jun 14, 2011 at 11:34 PM, Bill Spitzak <[email protected]> wrote:
> It would be a hassle to update every widget whenever the window was
> dragged.
If you're just sliding the window around, the widget's positions
do not change. (ie. their x/y/w/h values remain the same)
Keep in mind that all widget's positions are relative to the upper-left
corner of the FLTK window, which is 0,0.
So just moving the window around does not change the child widget's
x/y/w/h values at all; a widget at 10,10 retains that position relative
to the upper/left corner of its window, no matter where the parent
window
is positioned on the desktop.
The only values that change when you move a window is the window's
own x/y values, which are relative to the parent window (the desktop).
Note too that any effort involved in moving widgets around is
handled by the widget's own resizing code, which is usually not
changed by the widget, and handled by FLTK.
If you're writing your own widget code that needs its own special
resize behavior that regular FLTK resizing can't get you (with eg.
scroll widgets, tile widgets, or the default resize() behavior controls;
see below) then you have to be more aware of how resizing works.
But all widget toolkits involve this sort of thing.
Widget positions can be changed when you /resize/ a window
(squash/stretch it) to keep their respective positions constant,
and that resize behavior can be controlled in various ways so that,
for instance, widgets can be prevented from moving around at all,
or only resize on a certain axis, etc.
There are many widgets that control widget resizing behavior (Fl_Scroll,
Fl_Group, Fl_Tile, etc) as well as FLTK's built in resizable() control
which lets you control whether resizing affects widgets or not; you can
read about that in this article:
http://fltk.org/articles.php?L415+I0+T+M1000+P1
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev