Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fluid Form Layout in Delphi

We have developed a software. In this software we are show and hiding a few controls on various input screens depending on various situations.

When we hid a control what happens is that the space occupied by that control is left as it is and layout looks very bad at times esp. in screens that have larger numbers of controls. Our client does not like this and has asked us to do something about this.

My question: Is there some way by which we can create Fluid Layouts so that when a control is hidden the rest of the controls automatically adjusts themselves to fill the empty space left by the control hidden and when the control is show they should automatically make way for the control and adjust themselves accordingly.

I know we can achieve this by coding but that will require a lot of code in each screen for adjusting the layout. I am looking something which will reduce coding in each screen as there are 80+ screens.

Please suggest some way which is less error pron and can get rid of unnecessary coding in each input screen.

like image 886
Yogi Yang 007 Avatar asked Nov 23 '09 05:11

Yogi Yang 007


2 Answers

I think your best option is to use a component that handles the layout of your vcl controls on your form in runtime (depending on the conditions that you define). I recommend you try the Devexpress ExpressLayout Control

you can find two great demo videos here

  • ExpressLayout Control - How to Customize Layout Views
  • ExpressLayout Control - Create and Customize a Simple Layout

alt text
(source: devexpress.com)

You can check these features

Auto-Management - Control groups and individual control elements are automatically managed by the Layout Control. You never worry about pixel-by-pixel positioning.

Form auto-sizing - The form can be automatically resized to fit its contents best.

Bye.

like image 145
RRUZ Avatar answered Oct 20 '22 00:10

RRUZ


Now, I'm not sure how complex layout you have, but I guess you can use TFlowPanel and/or TGridPanel for this. Flowpanel has a nice handling of components that change visiblity. I'm not sure how well gridpanel handles the same...

like image 41
Vegar Avatar answered Oct 20 '22 01:10

Vegar