Scroll bars and alignment by client in a nested form

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

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

therefore, the main form of the application contains the form of the object and another form on which the components can be placed (there also is a toolbar at the top to select components, but I did not show this).

Now, if I make the main shape larger, I would like the content to expand to fit it ...

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

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

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

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

the screen of course displays

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

and i need an auto scroll bar.

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

Any idea how to resolve this conflict? 1) the designer’s area should decrease and grow, always filling the right side of the main form when changing the main form 2) if a component is placed that will hang over the edge of the designer’s form, then it should increase the scroll bar

OR Am I completely missing the point? I have code that handles component placement - should I check it if I need to add scroll bars?

+6
source share
1 answer

I think a relatively simple solution would be to convert the Align form to alNone and put it and size on the parent form resize event. Presumably you have a splitter whose event sizes you will also have to listen to.

As long as you only have an inspector and design form, this is a fairly simple solution to implement. If you have additional tool windows, then this will become more complex, but the basic idea can be expanded.

+1
source

Source: https://habr.com/ru/post/886773/


All Articles