Types of windows

PowerBuilder provides the following types of windows: main, pop-up, child, response, Multiple Document Interface (MDI) frame, and MDI frame with MicroHelp.

Main windows

Main windows are standalone windows that are independent of all other windows. They can overlap other windows and can be overlapped by other windows.

You use a main window as the anchor for your application. The first window your application opens is a main window unless you are building a Multiple Document Interface (MDI) application, in which case the first window is an MDI frame.

For more on building MDI applications, see Building an MDI Application in Application Techniques.

Using main windows

Define your independent windows as main windows. For example, assume that your application contains a calculator or scratch pad window that you want to have always available to the user. Make it a main window, which can be displayed at any time anywhere on the screen. As a main window, it can overlap other windows on the screen.

Pop-up windows

Pop-up windows are typically opened from another window, which in most cases becomes the pop-up window's parent.

Using the application's Open event

If you open a pop-up window from the application's Open event, the pop-up window does not have a parent and works the same way a main window works.

A pop-up window can display outside its parent window. It cannot be overlaid by its parent. A pop-up window is hidden when its parent is minimized and when its parent is closed. When you minimize a pop-up window, the icon for the window displays at the bottom of the desktop.

Using pop-up windows

Pop-up windows are often used as supporting windows. For example, say you have a window containing master information, such as film listings. You can use a pop-up window to allow a user to see details of a particular entry.

Explicitly naming a parent

In most cases, the window that opens a pop-up window becomes that window's parent. For example, if a script in w_go has this statement, w_go is the parent of w_popup:


You can also explicitly name a pop-up window's parent when you use Open in this way:

Open (popupwindow, parentwindow)

For example, the following statement opens w_popup and makes w_parent its parent:

Open(w_popup, w_parent)

However, there are also other considerations regarding which window becomes the parent of an opened window.

For more information, see the section called “Open” in PowerScript Reference.

Child windows

Child windows are always opened from within a main or pop-up window, which becomes the child window's parent.

A child window exists only within its parent. You can move the child window within the parent window, but not outside the parent. When you move a portion of a child window beyond the parent, PowerBuilder clips the child so that only the portion within the parent window is visible. When you move the parent window, the child window moves with the parent and maintains the same position relative to the parent.

Child windows cannot have menus and are never considered the active window. They can have title bars and can be minimizable, maximizable, and resizable. When they are maximized, they fill the space of their parent; when they are minimized, their icon displays at the bottom of their parent.

The initial position of the child is relative to the parent and not to the entire screen. A child window closes when you close its parent.

You will probably not use child windows very often. Typically, if you want to display windows inside other windows, you will write MDI applications, where much of the window management happens automatically.

For more on building MDI applications, see Building an MDI Application in Application Techniques.

Response windows

Response windows request information from the user. They are always opened from within another window (its parent). Typically, a response window is opened after some event occurs in the parent window.

Response windows are application modal. That is, when a response window displays, it is the active window (it has focus) and no other window in the application is accessible until the user responds to the response window. The user can go to other applications, but when the user returns to the application, the response window is still active. Response windows act like modal pop-up windows.

Using response windows

For example, if you want to display a confirmation window when a user tries to close a window with unsaved changes, use a response window. The user is not allowed to proceed until the response window is closed.

Using message boxes

PowerBuilder also provides message boxes, which are predefined windows that act like response windows in that they are application modal. You open message boxes using the PowerScript MessageBox function.

For more information, see the section called “MessageBox” in PowerScript Reference.

MDI frames

An MDI window is a frame window in which you can open multiple document windows (sheets) and move among the sheets. There are two types of MDI frame windows: MDI frame and MDI frame with MicroHelp.

For more on building MDI applications, see Building an MDI Application in Application Techniques.