Moving and resizing controls

There are several ways to move and resize controls in the Layout view.

Moving and resizing controls using the mouse

To move a control, drag it with the mouse to where you want it.

To resize a control, select it, then grab an edge and drag the edge with the mouse.

Moving and resizing controls using the keyboard

To move a control, select it, then press an arrow key to move it in the corresponding direction.

To resize a control, select it, and then press:

  • Shift+Right Arrow to make the control wider

  • Shift+Left Arrow to make the control narrower

  • Shift+Down Arrow to make the control taller

  • Shift+Up Arrow to make the control shorter

Aligning controls using the grid

The Window painter provides a grid to help you align controls at design time. You can use the grid options to:

  • Make controls snap to a grid position when you place them or move them in a window

  • Show or hide the grid when the workspace displays

  • Specify the height and width of the grid cells

To use the grid

  1. Choose Design>Options from the menu bar and select the General tab.

  2. Do one or more of the following:

    • Select Snap to Grid to align controls with a horizontal and vertical grid when you place or move them

    • Select Show Grid to display the grid in the Layout view

    • Specify the width of each cell in the grid in pixels in the X text box

    • Specify the height of each cell in the grid in pixels in the Y text box

Hiding the grid

Window painting is slower when the grid is displayed, so you might want to display the grid only when necessary.

Aligning controls with each other

You can align selected controls by their left, right, top, or bottom edges or their horizontal or vertical centers.

PainterBars in the Window painter

The Window painter has three PainterBars. PainterBar1 includes buttons that perform operations that are common to many painters, including save, cut, copy, paste, and close. PainterBar2 includes buttons used with the Script view. PainterBar3 contains buttons that manipulate the display of the selected control or controls. The tools used to align, resize, and adjust the space between controls are on a drop-down toolbar on PainterBar3.

To align controls

  1. Select the control whose position you want to use to align the others.

    PowerBuilder displays handles around the selected control.

  2. Press and hold the Ctrl key and click the controls you want to align with the first one.

    All the selected controls have handles on them.

  3. Select Format>Align from the menu bar, or select the Layout drop-down toolbar in PainterBar3.

  4. Select the dimension along which you want to align the controls.

    PowerBuilder aligns all the selected controls with the first control selected.

Equalizing the space between controls

You can manually move controls by dragging them with the mouse. You can also equalize the space around selected controls using the Format menu or the Layout drop-down toolbar.

To equalize the space between controls

  1. Select the two controls whose spacing is correct.

  2. To do so, select one control, then press and hold Ctrl and click the second control.

  3. Press Ctrl and click to select the other controls whose spacing should match that of the first two controls.

  4. Select Format>Space from the menu bar, or select the Layout drop-down toolbar in PainterBar3.

  5. Select horizontal or vertical spacing.

Equalizing the size of controls

Using the Format menu or the Layout drop-down toolbar, you can adjust selected controls so that they are all the same size as the first control selected. You might do this if you have several SingleLineEdit or CommandButton controls on a window.

To equalize the size of controls

  1. Select the control whose size is correct.

  2. Press and hold Ctrl and click to select the other controls that should be the same size as the first control.

  3. Select Format>Size from the menu bar, or select the Layout drop-down toolbar in PainterBar3.

  4. Select the size for width, height, or both width and height.