How to prevent stretching/shrinking of dynamically added widgets on window resize?

42 views
Skip to first unread message

Patrick Madueke

unread,
Nov 17, 2022, 7:41:02 AM11/17/22
to fltkg...@googlegroups.com
How to prevent stretching/shrinking of dynamically added widgets on window resize?

Ian MacArthur

unread,
Nov 17, 2022, 7:59:39 AM11/17/22
to fltk.general
On Thursday, 17 November 2022 at 12:41:02 UTC oletter... wrote:
How to prevent stretching/shrinking of dynamically added widgets on window resize?

Might be useful to us to have more context for what you are actually doing; do you have some small, compile-able code samples, for example, that would illustrate what you are doing, and perhaps some descriptions of what effect you want to attain...

In general, if no widget in a container (i.e. a group or window, usually) is identified as the resizable, then any resizing it shared out amongst all the widgets.

The "usual solutions" are to either make the window non-resizable, or to assign a widget to "consume" the resizing (sometimes a hidden widget in the group is used to achieve this.)

There's a How-To that might help a bit : https://www.fltk.org/articles.php?L415

 

Patrick Madueke

unread,
Nov 17, 2022, 11:04:13 AM11/17/22
to fltk.general
Thanks Ian MacArthur. Gonzalo Garramuño helped me get to a solution, similar to your suggestions.
I have a suggestion for FLTK maintainers like Ian MacArthur I guess. Why don't we have something like this implemented (like Constraint Layout in Android):

CoordinateManager().set(addrSubject)
  .leftTo (DIRECTION d, void* addrBenefactor, bool stretch = false)
  .rightTo (DIRECTION d, void* addrBenefactor, bool stretch = false)
  .topTo (DIRECTION d, void* addrBenefactor, bool stretch = false)
  .bottomTo (DIRECTION d, void* addrBenefactor, bool stretch = false)
  .centerTo (void* addrBenefactor)
  .centerTo (int x, int y, int x2 = 0, int y2 = 0)
  .leftTo (int x, bool stretch = false)
  .rightTo (int x, bool stretch = false)
  .topTo (int y, bool stretch = false)
  .bottomTo (int y, bool stretch = false)
.set(addrBenefactor)
  .leftBy (int n, bool stretch = false)
  .rightBy (int n, bool stretch = false)
  .topBy (int n, bool stretch = false)
  .bottomBy (int n, bool stretch = false)
.render();

Just x, y, w, h manipulations.

Ian MacArthur

unread,
Nov 17, 2022, 12:11:48 PM11/17/22
to fltk.general
On Thursday, 17 November 2022 at 16:04:13 UTC oletter... wrote:
Thanks Ian MacArthur. Gonzalo Garramuño helped me get to a solution, similar to your suggestions.
I have a suggestion for FLTK maintainers like Ian MacArthur I guess. Why don't we have something like this implemented (like Constraint Layout in Android):

The closest equivalent in fltk would probably be Fl_Flex - does that address your issues?


Patrick Madueke

unread,
Nov 17, 2022, 12:42:45 PM11/17/22
to fltkg...@googlegroups.com
Emmm. I am OK. Thanks.
--
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/444d3688-7321-411c-9ffd-9f6cc37d5e90n%40googlegroups.com.

Jose Q

unread,
Nov 23, 2022, 2:53:10 AM11/23/22
to fltk.general
I have added a fluent interface to Fl_Flow that is similar to what you want. Give it a look:

Patrick Madueke

unread,
Nov 23, 2022, 1:18:21 PM11/23/22
to fltk.general
Thanks Jose... To be downloaded later.
Reply all
Reply to author
Forward
0 new messages