## The `anchors' property

Four-element boolean vector

Valid for: All visible controls

The `anchors` property defines which edges of the window the control is anchored to. It comprises a vector of four boolean values, which govern whether the control is anchored to the top, left, bottom and right of the window respectively. The default is 1 1 0 0, meaning that the control is anchored to the top and left of the window. As the window is resized, the position of the control remains fixed relative to the top left.

If you set the `anchors` property to 0 0 1 1, the control will be anchored to the bottom and right of the window. This means that, as the window is resized, the control will remain at a constant distance from the bottom right corner of the window (its `where` property will change accordingly), as in this example:

            Win1.But.anchors„0 0 1 1

If a control is anchored to both the left and the right, then as the window is re-sized, the left edge of the control will remain at a fixed distance (as initially set by the `where` property) from the left edge of the window, and the right edge of the control will remain at a fixed distance from the right edge of the window. Thus the control will grow or shrink horizontally with the window. Similarly, if the control is anchored to both the top and the bottom, it will grow or shrink vertically with the window. This example causes the control to grow or shrink with the window in both directions:

            Win1.Ed.anchors„1 1 1 1

Topic: APLX Help : System Classes : Properties : anchors

[ Previous | Next | Contents | Index ]