Enhanced multi-monitor support

Both PowerBuilder IDE and PowerBuilder Runtime have been improved to better support multiple monitors.

PowerBuilder IDE improves support for multiple monitors, including:

  • The IDE main window can be freely moved across multiple screens.

    There is no longer the issue of floating toolbars disappearing when moving around in the extended screen. But note that when using the question mark icon in the wizard (such as Application Project Wizard), the popup help text may not display in the right position in the extended screen.

  • The IDE main window (whether maximized or not) remembers its position on the primary or extended screen and automatically restores to the same position and screen on the next startup.

  • Internal window or dialog (such as Browser, System Options, etc.) or tool (such as .NET DLL Importer, RibbonBar Builder, etc.) opens on the same screen as the IDE main window. Once opened, they can be freely moved across multiple screens. If the window or tool (such as RibbonBar Builder) contains child windows, the child window will open on the same screen as the window or tool. However, there are a few exceptions:

    • Standalone Translator Tool or Translation Toolkit (launched from File > New menu > Tool tab, or from Windows Start menu > Appeon PowerBuilder 2025) always opens on the primary screen the first time it is opened. After that, it remembers its position on the primary or extended screen and automatically restores to the same position and screen when opened again.

    • The Help (launched from Help > Contents menu, F1 key, or from Windows Start menu, etc.) always opens on the primary screen the first time it is opened. After that, it remembers its position on the primary or extended screen and automatically restores to the same position and screen when opened again.

    • When a Web site or page (such as Help > Community Q&A, Online Product Manuals, PowerBuilder Demo Apps, PowerBuilder Education, Technical Support, Latest Product News etc.) is accessed from the IDE, it will be opened in the system default Web browser, and if the system default Web browser remembers its last position, it automatically restores to the same position and screen, otherwise, it launches on the primary screen by default. Likewise, system browsers (such as Windows File Explorer opened when you select "Open Containing Folder" in the IDE) have the same behavior.

Compiled PowerBuilder applications improve support for multiple monitors, including:

  • The PowerBuilder application can be freely moved across multiple screens. The application main window remembers its position on the primary or extended screen and restores to the same position and screen on the next startup.

  • During runtime, the window opens on the same screen as the previously opened window. Once opened, it can be freely moved across multiple screens. However, there are a few exceptions:

    • System dialogs or windows opened by the PowerBuilder function calling the Windows API will appear on the same screen as the window where the function is called. Once opened, it can be freely moved across multiple screens. For example, when the PrintSetup function opens the Windows Printer Setup dialog box, the dialog box will appear on the same screen as the window executing the PrintSetup function. But if the function (for example, MessageBox) is executed in the Application Open event before any window is opened, the message box will appear on the primary screen.

    • Sheet window opened within the MDI/MDIHelp frame window will appear on the same screen as the MDI/MDIHelp frame window and will move along with it.

    • Child window will open on the same screen as its parent window. Once opened, it can be freely moved across multiple screens.

  • The Environment object is added with two properties: ScreenX and ScreenY, to obtain the coordinates of the current screen. Developers can use these properties to adjust the window's position on extended screens, such as centering the window on an extended screen (view the code example in the next section).

  • By the way, the PrintScreen function can print the current window, regardless of whether it is on the primary or extended screen. And we also fixed the issue of DropDownDW column's show list being obscured by the border on extended screen.

Code example for centering the window on extended screens

If you use the following code, without the code in bold, to center the window on the screen, the code works perfect in the primary screen, but not on the extended screen.

To center the window in the primary screen and the extend screen, you need to add the following code in bold (to get the coordinates of the current screen):

Integer             li_screenheight
Integer             li_screenwidth
Integer             li_rc
Integer             li_x = 1
Integer             li_y = 1
environment    lenv_obj

// Check for a window association with this object
If IsNull(iw_requestor) Or Not IsValid (iw_requestor) Then
            Return -1
End If

// Get environment
If GetEnvironment (lenv_obj) = -1 Then
            Return -1
End If

// Determine current screen resolution and validate
li_screenheight = PixelsToUnits (lenv_obj.screenheight, YPixelsToUnits!)
li_screenwidth = PixelsToUnits (lenv_obj.screenwidth, XPixelsToUnits!)
If Not (li_screenheight > 0) or Not (li_screenwidth > 0) Then
            Return -1
End If

// Get center points
If li_screenwidth > iw_requestor.Width Then
            li_x = (li_screenwidth / 2) - (iw_requestor.Width / 2)
End If
If li_screenheight > iw_requestor.Height Then
            li_y = (li_screenheight / 2) - (iw_requestor.Height / 2)
End If

// Get the X and Y coordinates of the screen where the window will display
int nScreenX, nScreenY
nScreenX = PixelsToUnits ( lenv_obj.screenx, XPixelsToUnits! )
nScreenY = PixelsToUnits ( lenv_obj.screeny, YPixelsToUnits! )

li_x = nScreenX + li_x
li_y = nScreenY + li_y

// Center window
li_rc = iw_requestor.Move (li_x, li_y)
If li_rc <> 1 Then
            Return -1
End If

Return 1