Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrollbars and align to client in a nested form

Tags:

delphi

My app has a form - which is used to design other forms and contains an Object Inspector (bas ascii art follows)

-----------------------
|obj | design forms   | 
|insp| here           |
|    |                |
-----------------------

so, the app''s main form contains the object form and another form onto which components can be placed (there's also a toolbar at the top to select components, but I haven't shown that).

Now, If I make the main form larger, I would like the contents to expand to fit it ...

-------------------------------
|obj | design forms           | 
|insp| here                   |
|    |                        |
|    |                        |
|    |                        |
-------------------------------

so my "form designer" form has Align := alClient;

but, if I place a component on it, so that it overlaps the edge ...

-------------------------------
|obj | design forms           | 
|insp| here              -----------
|    |                   |component|
|    |                   -----------
|    |                        |
-------------------------------

the screen of course shows

-------------------------------
|obj | design forms           |
|insp| here              -----|
|    |                   |comp|
|    |                   -----|
|    |                        |
-------------------------------

and I would like an auto scroll bar.

But, it seems that Align := alClient; overrides AutoScroll := true;

Any idea how to resolve this conflict? 1) the designer area should shrink and grow, always filling the right part of the main form as the main form is resized 2) if a component is placed which would overhang the edge of the designer form then it should grow scroll bar(s)

OR am I totally missing the point? I have code that handles the placing of the component - should I be checking there if I need to add scrollbars?

like image 820
Mawg says reinstate Monica Avatar asked Apr 27 '11 07:04

Mawg says reinstate Monica


1 Answers

I think a relatively easy solution would be to switch the form's Align to alNone and position and size it on the parent form's resize event. Presumably you've got a splitter in there whose size events you would also have to listen to.

So long as you only have the inspector and the design form then that's a pretty simple solution to implement. If you have more tool windows in there then it would get more tricky but the basic idea can be extended.

like image 93
David Heffernan Avatar answered Oct 10 '22 03:10

David Heffernan