FLTK logo

Re: [fltk.general] resizable question

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: resizable question Albrecht Schlosser Nov 21, 2020  
 
On 11/21/20 9:24 AM Greg Ercolano wrote:
Holy crap, cool! Thanks Albrecht, I'll have to look closely at what you did, it's the end of day here, but I just compiled this and it seems to work fine.

As I wrote before, bringing it to the point:

(1) The group (ab_grp) around A + B and its resizable() A make B fixed width.

(2) The invisible box "around" the border between B (ab_grp) and C as the window's resizable() make both ab_grp and C resize.

(3) The resizing of ab_grp and C is distributed proportionally to the overlapping widths of the invisible box (box_i) with ab_grp and C, respectively. If we choose the overlap width equal on both sides, they resize evenly.

(4) Since box B is fixed width, the resizing of ab_grp is applied to box A and this makes the whole interface resize symmetrically.

I modified the source code to make it shorter (removed the globals) and adjusted box sizes slightly. I also added a size_range() to achieve a well-defined minimal window size. See attached 3rd version of 'r.cxx'.

This technique should be woven into the resizable() article, I'll see if I can do that too, unless you want to. Don't want to loose this valuable info..

I'd appreciate if you could do this. I'm not that good at writing docs and I'm currently busy developing other FLTK stuff and trying to fix STR's and issues.

The demo program could also be added to the examples folder with appropriate comments or perhaps included in the resizing chapter of the docs.


On Friday, November 20, 2020 at 5:31:49 PM UTC-8 Albrecht Schlosser wrote:

    On 11/21/20 1:29 AM Greg Ercolano wrote:
     > On 2020-11-20 15:22, Albrecht Schlosser wrote:
     >>
     >> I started with Ian's code and tried my idea but it doesn't seem
    to work
     >> as requested. Maybe the position and size of this invisible box
    (box_i)
     >> can be changed to get the correct relations but I don't know.
    Would need
     >> to look into the resizing code to see how the relations are
    calculated
     >> (but not tonight).

    I couldn't resist and did it...
    ;-
     >> See attached file r.cxx.
     >
     >     Thanks -- yes, I just don't think it's possible to keep B
    centered doing any of the resizable
     >     tricks we're normally used to.

    Well, it *is* possible! :-)

    See attached new version of 'r.cxx'. Running it and resizing makes the
    layout look familiar - like test/cube.cxx which I know was the reason
    you asked. ;-)

    The "secret" (revealed by a little math and the code in
    Fl_Group::resize()) is to put the invisible box centered over the
    border
    between the two boxes B and C. As long as the overlap is equal on both
    sides the two boxes (ab_grp and box_c) resize by the same amount and
    therefore A and C resize symmetrically.

    For simplicity I made all the boxes adjacent with widths 200, 100, 200,
    resp. and put the invisible box on x = 250 with width = 100 (50 left of
    the border and 50 right of the border). That's it!

--
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/d92242e2-4a5e-ee42-73ca-d14b888ccd96%40online.de.
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'.