I'm trying to figure out how to get a child widget to
conform to the dimensions of it's parent widget exactly.
While the code below (modeled after the code from Fl_pack.cxx does a decent job of
resizing the child widget, when resizing the window the child
and parent can differ a pixel or two in size. This is
particularly noticeable when when resizing the window quickly.
It seems the drawing of the child is somehow "lagging
behind" the drawing of the parent.
I don't know the language you
posted, but it looks like you might be resizing
in the draw() method, that'd
explain why you're seeing a lag.
Don't do resizing in draw().
The ONLY thing you should really do in draw() code is draw
stuff.
If you want precise resizing, subclass the group widget and
override the resize(x,y,w,h)
method, and inside that:
1) Tell the baseclass to resize(),
2) Set the child to the size you want
3) Call init_sizes() last, so the group knows you changed
the size of one of its children
Comments are owned by the poster. All other content is copyright 1998-2025 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.