FLTK logo

Re: [fltk.general] Pixel perfect resizing of a groups child

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Pixel perfect resizing of a groups child Greg Ercolano Jun 19, 2021  
 


On 6/19/21 1:24 PM, Webb Hinton wrote:
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, t
hat'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

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/df915a0f-bfba-985e-94d5-f2a4f9abe066%40seriss.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.