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 20, 2020  
 
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/b3f40ece-40c5-591a-b605-731b93582448%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'.