Consultor Eletrônico



Kbase 20709: Close of Dialog-Box does not return focus to correct window.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/10/2008
Status: Verified

SYMPTOM(s):

Close of Dialog-Box does not return focus to correct window.

After closing a Dialog-Box the focus is not returned to correct the window.

CAUSE:

When running several smart windows persistently from a main window, where each window has a trigger for calling a dialog box.

On close of the dialog-box you might find that the focus does not return to the window that called the dialog box. Instead it returns focus to the last window to be run persistent and initialised.

The reason for this could be the file SRC/ADM/TEMPLATE/WINDOWMN.I.

/* windowmn.i - Main Block code for objects which create windows.*/
/* Skip all of this if no window was created. */
/* Set CURRENT-WINDOW: this will parent dialog-boxes and frames. */

IF VALID-HANDLE({&WINDOW-NAME}) THEN DO:
ASSIGN CURRENT-WINDOW = {&WINDOW-NAME}
{&WINDOW-NAME}:KEEP-FRAME-Z-ORDER = YES
THIS-PROCEDURE:CURRENT-WINDOW = {&WINDOW-NAME}.

/* The CLOSE event can be used from inside or outside the
procedure to */

/* terminate it.*/
ON CLOSE OF THIS-PROCEDURE
RUN dispatch IN THIS-PROCEDURE ('destroy':U).

RUN dispatch ('create-objects':U)

This code assigns the parent window for dialog-boxes and frames and
is automatically included by Progress in the main block of all smart windows.

Everytime you run and initialise a persistent smart window, this code fires and assigns the parent as being the current-window.

If you run several persistent windows, this logically means that each time a new window is run, the parent is re-assigned and is set to this "current-window".

So the last window to be initialised will always be the parent for all dialog boxes.

This can cause unwanted parenting.

FIX:

There are two possible solutions for returning focus back to the calling window.

1) In the trigger that calls the dialog-box per window.
Add APPLY "ENTRY" TO-SELF after the call.

2) Ammend WINDOWMN.I to include

ON ENTRY OF {&WINDOW-NAME}
DO:
ASSIGN CURRENT-WINDOW = {&WINDOW-NAME}.
END.

Whenever the user enters the window. This then sets the parent to the correct CURRENT-WINDOW.