Displaying sheets in tabbed view

Tabbed view displays sheets opened in the MDI frame window as tabs; it can be automatically implemented without needing to write or change any code.

Enabling the tabbed view

When the window type is MDI or MDIHelp, you can directly take advantage of the IDE options to implement the tabbed view.

  • TabbedView option -- Adds a tabbed bar to the upper part of the MDI client area and displays the sheets opened in the MDI window as tab pages automatically.

  • MaximizeAllTabbedSheets option -- Displays all tabbed sheets (opened via OpenSheet or OpenSheetWithParm) at the maximum size.

The TabbedView and MaximizeAllTabbedSheets options can only be set (enabled or disabled) in the IDE; they cannot be set via scripts. But you can get the state (enabled or disabled) of these options through the following Window functions: IsTabbedViewEnabled and IsMaximizeAllTabbedSheetsEnabled.


What a tabbed view looks like

Like other tab pages, the tabbed view contains the tab header (each has an icon ③, title text ⑤, separator ④, and close button ②) and the menu (⑦).

An end-user can navigate through tabs by clicking their headers, or by selecting the menu (⑦).

The indicator (⑥) at the right end of the tab bar will show differently if the bar has not enough space to show the header of all of the opened sheets. indicates there are opened sheets invisible from the tab bar; and the user can click the icon to select and display the invisible sheet from the menu list (⑦). indicates all opened sheets are visible from the tab bar; the user can click the tab header to switch the sheets.


Following is a tabbed view example in the Example Sales App.

You can run the Example Sales App from Windows Start | Appeon PowerBuilder [version] | Example Sales App, or from the installation folder %Public%\Documents\Appeon\PowerBuilder [version]\Code Examples\Example Sales App, or download from GitHub: https://github.com/Appeon/PowerBuilder-Sales-Example.


How a tabbed view is implemented

When the TabbedView option is selected, a tabbed bar is automatically displayed in the MDI client area. It has the following specialties:

  • Built-in control: The tabbed bar is added as a built-in control to the MDI client area; it is automatically created from the TabbedBar control and named as mditbb_1. Please do not call the function/event/property of the TabbedBar control in your application, except the properties listed below.

  • Visibility: The tabbed bar is invisible at the design time (in the IDE) and visible only at runtime.

  • Position: The tabbed bar is bound to and contained inside the MDI client area; it is placed at a fixed location, always at the uppermost part of the MDI client area.

    When a sheet is opened, the y value of the MDI client area automatically increases and its height automatically decreases by the height of the tabbed bar. When all sheets are closed, the y value of the MDI client area automatically decreases and its height automatically increases with the height of the tabbed bar.


  • Height: The height of the tabbed bar is 104 pixels by default. If the font type or size of the title text is changed and the AutosizeHeight property is set to True, the height will change according to the font type/size. You can get the actual height through the Height property at runtime.

    If your app contains logics for static interface layout registration, similar to FPC framework, please be aware that 1) the tabbed bar is visible only at runtime (invisible at the design time / in the IDE), 2) if your app dynamically changes the font type or size of the title text (and the AutosizeHeight property is True), the height of the tabbed bar will change according to the font type/size at runtime; you can get the actual height of tabbed bar through the Height property at runtime.

  • Window height: When the tabbed bar is shown, the height of the MDI frame window will NOT change. There is no need to write scripts in the Resize event to adjust the window height or location, which differs from the case of showing the RibbonBar in the MDI window.

Manipulating the tabbed view

When the TabbedView option is selected, an mditbb_1 object is automatically shown at the uppermost part of the MDI client area at runtime. This object is invisible in the design time within the IDE and only becomes visible when the application is running.

You should not execute the functions or events of the mditbb_1 object. You can only get and set the following properties:

  • ShowIcon -- Whether to show the window icon in the tab header. Default is True.

    If no icon is set for the sheet windows, then the icon of the MDI/MDIHelp window will be displayed; if no icon is set for the MDI/MDIHelp window and the sheet windows, then the default icon for window will be displayed.

    mditbb_1.ShowIcon = true
  • ShowCloseButton -- Whether to show the close button in the tab header. Default is True.

    mditbb_1.ShowCloseButton = true
  • ShowSeparator -- Whether to show the separator symbol between the tab headers. Default is True.

    mditbb_1.ShowSeparator = true
  • ShowText -- Whether to show the window title in the tab header. Default is True.

    If no title is set for the sheet windows, then "Untitled" will be displayed as the title.

    mditbb_1.ShowText = true
  • ShowPowerTips -- Whether to show a PowerTip when the user moves a cursor over the tab header. Default is True.

    When this property is true, the value of the PowerTipText property of the sheet window will be displayed as the PowerTip.

    If the Window PowerTipText property has no value, then the window title will be displayed as the tool tips; if the window title has no value, then "Untitled" will be displayed as the tool tips.

    mditbb_1.ShowPowerTips = true
  • ShowContextMenu -- Whether to display the popup menu when the right mouse button is clicked on the tab header. Default is True.

    The following menus may be available in the popup menu: Close Current Tab, Close Tabs to the Left, Close Tabs to the Right, Close All But This, and Close All Tabs.

    mditbb_1.ShowContextMenu = true
  • TextSize -- The font size of the text in the tab header, in points. For backward compatibility, the size is stored as a negative number; for example, 15-point text size is stored as -15.

    When the font size is changed and the AutosizeHeight property is true, the height of the tabbed bar is automatically adjusted to the best size, therefore, you can adjust the font size to adjust the bar height. The Code Example App included in the product contains code examples for this.

    mditbb_1.TextSize = -15
  • FaceName -- The font name for the text shown in the tab header. Default is Tahoma.

    mditbb_1.FaceName = "Tahoma"
  • NewTabAtRightMost -- Whether to open the new tab from the left most location or the right most location of the bar. Default is true (the right most location).

    mditbb_1.NewTabAtRightMost = false
  • AutosizeHeight -- Whether the height of the tabbed bar automatically changes according to the font type or size of the title text. Default is true. When FALSE, the height is always 104 pixels.

    mditbb_1.AutosizeHeight = false

Maximizing sheet windows

When the MaximizeAllTabbedSheets option is selected, all tabbed sheets (opened via OpenSheet or OpenSheetWithParm) will be opened and displayed at the maximum size, ignoring the arrangeopen argument of the OpenSheet/OpenSheetWithParm method. But after that

  • If the user has arranged the opened sheets manually in a different way, for example, cascade the sheets, then the newly opened sheets will be displayed as cascaded (instead of maximized).

  • If the user switches the sheet windows by selecting the tab header or the tabbed view menu, and if the MaxBox option is not selected, the sheet window will not display as maximized. To have the sheet windows display as maximized all the time, you can select the MaxBox option in the IDE painter, or enable the MaxBox property in the window Open event via scripts.

When the MaximizeAllTabbedSheets option is selected, the resize event of the sheet window will be triggered twice. The first trigger occurs when the sheet window is opened, and the second trigger occurs when it detects that the MaximizeAllTabbedSheets option is selected.

Using tabbed view does not resolve the limitations of the sheet window, for example, you still cannot hide a window that was opened as an MDI sheet (the value of the Visible property is ignored after a sheet is opened).

If there are API calls to the sheet window, for example, to set a sheet window as the background, these API calls may conflict with the tabbed view.

Refreshing the main window

In case of a need to refresh the main window when switching the sheet windows, you will need to write scripts in the Activate event of the sheet window.

Take the Example Sales App > Address sheet window (w_address) for example.

You can run the Example Sales App from Windows Start | Appeon PowerBuilder [version] | Example Sales App, or from the installation folder %Public%\Documents\Appeon\PowerBuilder [version]\Code Examples\Example Sales App, or download from GitHub: https://github.com/Appeon/PowerBuilder-Sales-Example.

Before the Address sheet window (w_address) is opened, the Action category is disabled (unavailable for use) in the main window.


After clicking the Address icon to open the Address sheet window (w_address), the Action category is enabled in the main window.


Below is how to write scripts to achieve this result.

To refresh the Action category in the main window, you will need to write the following script in the Activate event of the Address sheet window (w_address):

parentwindow().dynamic post event ue_refresh_visible(this.title)


Using tabbed view in inherited windows

To use tabbed view in an inherited window, you should select the TabbedView option in the parent window only (the child window will automatically inherit and select the TabbedView option), or select the TabbedView option in the child window only.

Do not select the TabbedView option in the child window first and then select the TabbedView option again in the parent window, otherwise, there will be compiler errors ("Incompatible types in assignment") when the application is full built, or the R0005 internal error when the application is run from IDE.

The reason is when tabbed view is enabled, a tabbed bar control will be added automatically to the window and this control will follow the same inheritance rules as the other controls.

Using themes

Make sure your theme files have been upgraded to the current version, otherwise, the tabbed bar may display in all black.

Other than that, there is nothing different between the tabbed bar control and the other controls, regarding the usage of UI theme.

For more information, refer to the section called “Specifying a theme for the application UI” in Users Guide.

Packaging runtime files

If you use the Runtime Packager to package the application runtime files, you need to select the "TabbedView Support" option to automatically package the runtime file required for tabbed view.

If you manually package the PowerBuilder runtime files, please go to the PowerBuilder Runtime location and get the following runtime file required for tabbed view to work: pbtabbedbar.dll.