Consultor Eletrônico



Kbase P4306: Dialog-box does not appear on second screen with dual monitors
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   2/7/2008
Status: Verified

FACT(s) (Environment):

Progress 9.1x
OpenEdge 10.x

SYMPTOM(s):

Using dual monitors

DIALOG-BOX does not appear on wanted screen/virtual desktop

DIALOG-BOX always appears on the same screen as its parent window

Changing X and Y parameters of the DIALOG-BOX will move it but not beyond the edge of the monitor

A Window widget can be positioned on the second monitor screen when X and Y parameters are modified

Multiple virtual desktops

CAUSE:

Expected behavior: a DIALOG-BOX is displayed on the desktop that manages its PARENT WINDOW, which is sometimes a hidden DEFAULT-WINDOW.

FIX:

Option #1
Use the SetWindowPos Win32 API function to reposition the DIALOG-BOX.

PROCEDURE SetWindowPos EXTERNAL "user32".
DEFINE INPUT PARAMETER hwnd_win AS LONG. /* Handle to the window */
DEFINE INPUT PARAMETER hwnd_beforeWin AS LONG. /* Handle to the window to precede positioned window in the Z order */
DEFINE INPUT PARAMETER iX AS LONG. /* New position of the left side of the window */
DEFINE INPUT PARAMETER iY AS LONG. /* New position of the top of the window */
DEFINE INPUT PARAMETER iWidth AS LONG. /* New width of the window in pixels */
DEFINE INPUT PARAMETER iHeight AS LONG. /* New height of the window in pixels */
DEFINE INPUT PARAMETER iFlag AS LONG. /* Windows sizing and positioning flags */
DEFINE RETURN PARMETER result AS LONG. /* Return value of the routine */
END PROCEDURE.

RUN SetWindowPos (FRAME dialog-frame:HWND,
0,
1500,
500,
300,
250,
0,
OUTPUT i).

Refer to SetWindowPos documentation on MSDN for more information.

Option #2
Hide the DIALOG-BOX, move the PARENT WINDOW to wanted desktop then make the DIALOG-BOX visible as illustrated below:

DEFINE VARIABLE h AS HANDLE NO-UNDO.
ASSIGN FRAME fMain:VISIBLE = NO
h = FRAME fMain:PARENT
h:X = 3000 /*desktop on the right*/
FRAME fMain:X = 3000
FRAME fMain:VISIBLE = YES.

Alternatively manage an additional hidden window on the wanted desktop, making it the PARENT of the DIALOG-BOX.