FLTK logo

Re: [fltk.general] Understanding Fl_Pack.

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: Understanding Fl_Pack. Greg Ercolano Oct 02, 2022  
 

On 10/2/22 15:01, Gonzalo Garramuno wrote:

I have used Fl_Pack in the past and I always struggle with its behavior. 

    It's probably not the right fit for what you want, due to how it shrink-wraps
    itself around the gl group after you hide the red group, causing the gl group
    to remain its previous size, instead of expanding to fit.

    From the Fl_Pack docs, I believe it's the red text that is I think what's defeating you here:

This widget was designed to add the functionality of compressing and aligning widgets.
If type() is Fl_Pack::HORIZONTAL all the children are resized to the height of the Fl_Pack,
and are moved next to each other horizontally. [..]
Then the Fl_Pack resizes itself to surround the child widgets.

    ..which is why when you hide the red group, the gl group doesn't enlarge,
    but instead Fl_Pack shrinks around it.

    The reason for that behavior is the intended use inside an Fl_Scroll, where the
    pack would be the immediate child, so that the scrollbars adjust automatically
    when a widget in the pack is removed/hidden.

    I'm thinking for your simple widget arrangement, it might be easiest to not use
    an Fl_Pack group at all, just use a regular group, using your existing show/hide
    toggle for the red box, and just add a line to resize() the gl window to either full
    or 1/2 it's parent's group size to get the expansion behavior you want.

    You might be able to use Albrecht's new Fl_Flex widget (new in 1.4.x) for this,
    I'm not sure. He can probably advise.

--
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/d372c6af-4602-fe18-5e1b-c7a9bb8ce2db%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'.