Kbase P18208: How to list all widgets in the current Progress session?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  2/2/2003 |
|
Status: Unverified
GOAL:
How to list all widgets in the current Progress session?
FACT(s) (Environment):
Windows
FIX:
The following solution uses a recursive procedure to list all widgets contained in the given container handle.
For each widget a temp table record is created containing selected information about that widget.
The temp table contents are finally dumped into a text file for later processing if required.
DEFINE VARIABLE hCurrentWidget AS WIDGET-HANDLE NO-UNDO.
DEFINE TEMP-TABLE Widgets NO-UNDO
FIELD WidgetHandle AS WIDGET-HANDLE
FIELD WidgetName AS CHARACTER
FIELD WidgetType AS CHARACTER
FIELD WidgetParent AS WIDGET-HANDLE.
ASSIGN
hCurrentWidget = SESSION:HANDLE.
RUN WidgetList(hCurrentWidget).
OUTPUT TO myfile.txt.
FOR EACH Widgets NO-LOCK BY WidgetHandle:
DISPLAY
INTEGER(WidgetHandle) FORMAT "9999999"
WidgetName FORMAT "X(15)"
WidgetType FORMAT "X(15)"
INTEGER(WidgetParent) FORMAT "9999999".
END.
OUTPUT CLOSE.
PROCEDURE WidgetList:
DEFINE INPUT PARAMETER hWidgetScope AS WIDGET-HANDLE NO-UNDO.
DEFINE VARIABLE hCurrentWidget AS WIDGET-HANDLE NO-UNDO.
ASSIGN
hCurrentWidget = hWidgetScope:FIRST-CHILD NO-ERROR.
DO WHILE VALID-HANDLE(hCurrentWidget):
CREATE Widgets.
ASSIGN
WidgetHandle = hCurrentWidget
WidgetName = hCurrentWidget:NAME
WidgetType = hCurrentWidget:TYPE
WidgetParent = hCurrentWidget:PARENT.
RUN WidgetList(hCurrentWidget).
ASSIGN
hCurrentWidget = hCurrentWidget:NEXT-SIBLING.
END.
END PROCEDURE.