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 Greg Ercolano Nov 21, 2020  
  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.

This'll help with issue #157, as I didn't like the patch because I was using a procedural resize(). I'll be sure to credit this technique to you in the comments. 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..

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/1aa512a6-4978-4b0e-b948-16f4dc3a68e6n%40googlegroups.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'.