Consultor Eletrônico



Kbase P101859: How to find out if the focus is in a DIALOG or in a WINDOW ?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   07/03/2005
Status: Unverified

GOAL:

How to find out if the focus is in a dialog or in a window ?

FIX:

The idea is to go up in the widget tree until a DIALOG or a WINDOW is reached, as illustrated in the code given bellow, to implement in the CHOOSE trigger of a button that is located in a frame that is itself located in a frame that is itself... that is finally located in either a WINDOW or a DIALOG:
DEFINE VARIABLE hParent AS HANDLE NO-UNDO.
hParent = SELF.
DO WHILE hParent <> ?:
IF CAN-DO("DIALOG-BOX,WINDOW",hParent:TYPE) THEN DO:
MESSAGE "The focus is currently in a " hParent:TYPE
VIEW-AS ALERT-BOX INFO BUTTONS OK.
LEAVE.
END.
hParent = hParent:PARENT.
END.