Lock buttons in place?

Hi,
I have 3 buttons in my window, which are all side-by-side and horizontally centered.

Is it possible to keep all 3 buttons side-by-side and centered, even when the window is maximized?
I have tried lots of combinations for the locking of the buttons, but I cannot seem to work out the combination to achieve this.

The buttons keep stretching over each other.

Any help appreciated.

Control locking is only to edges of the window…
So one possible way is in the RESIZED/RESIZING event(s)

const padding=8
middle_button.left=(me.width-middle_button.width)/2
right_button.left=middle_button.left+middle_button.width+padding
left_button.left=middle_button.left-padding-left_button.width

where padding is how much space to maintian between the buttons

oh an remove any left/right control locks on the buttons

Thanks Dave!
Much appreciated.

A method I have found to be good, too, is to place a rectangle on the window and place the buttons inside the rectangle.

Set the rectangle border colour and fill colour to the same as the window backcolor.

Then you can use the resizing code on the one rectangle object and its internal controls stay in place.

Simon.

Cool - I will try that also.
Thanks.

[quote=191285:@Simon Berridge]A method I have found to be good, too, is to place a rectangle on the window and place the buttons inside the rectangle.

Set the rectangle border colour and fill colour to the same as the window backcolor.

Then you can use the resizing code on the one rectangle object and its internal controls stay in place.

Simon.[/quote]

It would work with a canvas as well, and the canvas is invisible.

I would put the three buttons in a container control with the following code in the window’s Open, Resizing, Resized, and Restore events.

my3buttons.left=(me.Width/2) - (my3buttons.Width / 2)

Rectangle, Canvas and Container Control are all containers.

Spoilt for choice :slight_smile: