Kbase 34792: How to get the handle to a SmartDataViewer given the handle to one of its widgets
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/10/1998 |
|
Solution ID: P4792
GOAL:
How to get the handle to a SmartDataViewer given the handle to one of its widgets
FACT(s) (Environment):
Windows
Progress 9.1C
FIX:
The following code returns a comma-separated list of all the handles of the Data Fields in the last SmartDataViewer procedure object executed during this session.
DEFINE VARIABLE cProc AS CHARACTER NO-UNDO.
DEFINE VARIABLE cList AS CHARACTER NO-UNDO.
DEFINE VARIABLE hProc AS HANDLE NO-UNDO.
ASSIGN hProc = SESSION:LAST-PROCEDURE.
DO WHILE VALID-HANDLE(hProc):
ASSIGN cProc = DYNAMIC-FUNCTION('getObjectType':U IN hProc) NO-ERROR.
IF cProc = "SmartDataViewer" THEN
DO:
ASSIGN cList = DYNAMIC-FUNCTION('getFieldHandles':U IN hProc) NO-ERROR.
LEAVE.
END.
ASSIGN hProc = hProc:PREV-SIBLING.
END.
The above code may be easily modified to loop through all the SmartDataViewer objects available and/or all SmartDataBrowser objects as well and do all kinds of tests on the handles and/or values of their fields.
Assuming the above code has been executed and the cList variable contains the comma delimited list of field handles contained inside the SmartDataViewer the following code will tell whether a given widget handle exists in the SmartDataViewer:
IF LOOKUP(STRING(FillInHandle),cList) NE 0 THEN
MESSAGE 'Handle is in the SmartDataViewer' VIEW-AS ALERT-BOX.
ELSE
MESSAGE 'Handle is not in the SmartDataViewer' VIEW-AS ALERT-BOX.