Choosing the window's size and position

Design-time window size

Main windows are automatically configured at runtime to match a deployment device’s full screen settings. At design time you can easily change a window’s size to match the size it will have on a deployment device. Selections for the IDE window size are:

The Design Size Default value sets the window displayed in the Window painter to the size selected on the Size tab of the Options dialog box. You display this dialog box by selecting Design>Options from the Window painter menu.

The Unconstrained value lets you set the design-time window size on the Other tab of the Properties view for the current window or by dragging the window handles in the Layout view. If you do not select Unconstrained before you set design-time window size on the Other tab or before you resize the window in the Layout view, PocketBuilder automatically changes the IDE Window Size drop-down list value to Unconstrained.

About PowerBuilder units

All window measurements are in PowerBuilder units (PBUs), except for those on the Size tab of the Options dialog box for the Window painter. Using PBUs, you can build applications that look similar on screens of different resolution. A PBU is defined in terms of logical inches. The size of a logical inch is defined by your operating system as a specific number of pixels. The number is dependent on the display device. Windows typically uses 96 pixels per logical inch for small fonts and 120 pixels per logical inch for large fonts. Windows CE devices typically use 96 pixels per logical inch.

Almost all sizes in the Window painter and in scripts are expressed as PBUs. The two exceptions are text size, which is expressed in points, and grid size in the Window and DataWindow painters, which is in pixels.

The PowerScript functions PixelsToUnits and UnitsToPixels return conversion values for a measurement that you assign as a function argument. For more about these functions, see the online Help.

Display idiosyncracies on VGA devices and emulators

The Windows CE operating system acts as though a VGA screen has the same dimensions as a QVGA screen, using the greater resolution to provide a higher quality picture and font definition rather than to increase the screen surface area. Although the PocketBuilder Window painter lets you set a window surface size for VGA screens in portrait (480 x 640 pixels) and landscape (640 x 480 pixels) orientations, it displays the full physical screen size for the extra resolution, in a manner consistent with the desktop dots-per-inch setting.

This results in certain display issues, with controls and fonts occupying a larger area of the display screen at runtime than at design time. When a DataWindow control is not completely visible on the screen, you might not be able to see a vertical or horizontal scroll bar if the number of rows or columns exceeds the screen display capability.

To work around this problem, you can call the ScreenDisplayZoom function. If you set the zoom factor to 50%, the sizes of controls and fonts on VGA devices and emulators at runtime match their pixel sizes at design time. Alternatively, you can use a QVGA screen size at design time, even when you deploy your applications to a VGA device or emulator. The windows automatically resize to fit the runtime screen dimensions, and the runtime controls retain the sizes that you set for them at design time.

Changing the default sizes of new windows

You can change settings for the default size of a main window. The PocketBuilder install program sets up a portrait orientation for main windows, but you can change this default on the Size tab of the Options dialog box for the Window painter.

The default size of a main window with a portrait orientation is 1097 by 1280 PBUs (240 by 320 pixels) without a menu bar, or 1097 by 1176 PBUs (240 by 294 pixels) if a menu bar is added. (You add a menu bar by selecting the MenuBar check box, or by assigning a menu to the window in the MenuName text box.)

The default size of a response window is 823 by 600 PBUs.

StepsTo change the default size of new windows

  1. Select Design>Options from the main menu for the Window painter.

  2. Click the Size tab and select the default size option you want for main windows.

    If you select the Custom radio button for a main window, you must enter values in pixels for the width and height of any new main windows you create in your target.

Resizing a main window in the Layout view

You can resize main and response windows in the Layout view of the Window painter. When you resize a window, the IDE Window Size selection value changes automatically to Unconstrained. At runtime, the size of a main window is modified automatically to fit the full screen size of the device where the window is deployed (unless you are deploying to the desktop).

StepsTo resize a window in the Layout view:

  1. Place the cursor on an outer edge of a window in the Layout view.

    The cursor becomes a two-headed arrow. The edge of the window where you place the cursor determines the angle of the arrow and the window size property that you can change.

  2. Drag the edge of the window to a new location.

    The new location determines the current window’s new width or height.

Resizing and repositioning windows in the Properties view

You can change a window’s width and height properties on the Other page of the Properties view. When you resize a window, the IDE Window Size selection value changes automatically to Unconstrained. At runtime, the size of a main window is modified automatically to fit the full screen size of the device where the window is deployed (unless you are deploying to the desktop).

You can change the x and y values of a response window only. The x and y values for a response window at runtime are relative to the upper-left corner of its main window parent (the bottom left edge of the Windows CE navigation bar).

StepsTo specify a window’s position and size:

  1. Click the window's background so that the Properties view displays window properties.

  2. Select the Other tab in the current window’s Properties view.

  3. Enter values for the x and y location of the window in PBUs.

    You can enter values only for a response window.

  4. Enter values for width and height in PBUs.

    The size of the window changes in the Layout view.