On 06/05/11 15:08, anon wrote:
> Hello again from the heart of the endless questions :)
>
> I have a window containing two boxes, a left one, and a right one. These
> boxes are supposed to be resized by subclassing the Fl_Window and
> reimplemting the handle() method such that when the mouse is pushed on the
> borderline between the two a variable is set to DRAG state and and subsequent
> drag events depending on that variable resizes the two boxes and so on.
Sounds like you've already done the work yourself, but
note this is what Fl_Tile is good for.
Chec out the test/tile program, and note you can move all of
the inner box's borders around by dragging them. It handles
all the dragging stuff for you. May save you some work in the future.
Or, yes, you can do it yourself, but be sure to..
> Now the propblem is that as soon as I drag the window (not the borderline
> between the boxes) the boxes immediately resize back to the last dimensions
> before this first window resize. I really do have no clue at this point what
> can be the cause for this, but clearly I'm not either subclassing properly or
> I've gotten my event management at handle() level "pretty" wrong.
..call init_sizes() for the parent group after making changes
to your box positions + sizes.
So if you have something like:
MyWindow::resize(..) {
// custom widget resizing stuff
init_sizes(); // call this before returning..!
}
If you reposition widgets inside a group (note: windows derive from
Fl_Group)
you need to call init_sizes() so that the group knows the new positions
of the widgets when you're done. This internally causes the window to
make
a snapshot of the size relationships of the children, so it can maintain
them as the window is resized.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk