Resizing Containers

Hi, I am new to XOJO and doing a proof-of-concept project to see if the app will do what I need.

So far I have found the container controls very useful. However, I am completed puzzled at how to make them resize correctly when maximizing the window. If I am reading the documentation correctly, they should resize automatically when I lock all four sides. This seems to work with the rectangle but the buttons and other controls do weird things when I maximize the main page with a container on it.

Could someone give me some direction on how best to do this?

Thank you.

are you locking the controls in the container? They should lock and react to the container as the container reacts to the window

another option is to create an “ARRANGE_CONTROLS” method… .and call this on the RESIZED event
and in that module adjust the sizes and postions.

Yes, I am locking the controls in the container. I have a container with six buttons, all locked. I put the container on the main page and locked it. When I maximize the window, it appears the container resizes correctly but the buttons inside it grow huge and overlap each other. I was hoping it was not necessary to write a routine for every control.

That will happen if you lock ALL 4 corners of a button… lock only two… Top/Left or Bottom/Right etc.

Thanks for the reply. That will eliminate the large push buttons but it does not resize the buttons for the maximized window. I guess there is no getting around writing a routine to resize and reposition the buttons so they grow as the window grows?

Giant buttons look quite ugly. Are you sure you want them?

Usually only TextAreas or ListBoxes resize, but not buttons.

An alternative is to use a canvas to make your own “button” though that may be a bit advanced if you just started.

until Xojo implements AutoLayout for Desktop, you have to do it yourself… hence the “arrange_controls” idea

The button container is just an example. I have a page panel with the same number of pages and each page has containers with buttons and other controls some of which resize oddly as well. I wonder when the autolayout will be available?

Do not design your code based on possible future enhancements… design your code with the tools available today.

Autolayout will be available the day after, the day before you hear that is it available.

[quote=166835:@Becky Walker]Hi, I am new to XOJO and doing a proof-of-concept project to see if the app will do what I need.

So far I have found the container controls very useful. However, I am completed puzzled at how to make them resize correctly when maximizing the window. If I am reading the documentation correctly, they should resize automatically when I lock all four sides. This seems to work with the rectangle but the buttons and other controls do weird things when I maximize the main page with a container on it.

Could someone give me some direction on how best to do this?

Thank you.[/quote]
What OS ?

Windows

[quote=166835:@Becky Walker]So far I have found the container controls very useful. However, I am completed puzzled at how to make them resize correctly when maximizing the window. If I am reading the documentation correctly, they should resize automatically when I lock all four sides. This seems to work with the rectangle but the buttons and other controls do weird things when I maximize the main page with a container on it.

Could someone give me some direction on how best to do this?[/quote]

First question to ask is : do you really need to resize the window ? Sometimes, a fixed size window is the best way to have a nice layout.

If you really need to resize or maximize the window, the best way I found was to work in percentage of growth of the window, then apply that to the controls so proportions remain the same. It works fine for controls such as TextArea and Listbox.

For buttons and popupmenus or segmentedcontrols, I usually simply change left and top, but not the size.