Consultor Eletrônico



Kbase 15162: Recursive procedure used to walk the widget tree
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
Recursive procedure used to walk the widget tree

The following code segments show one way to walk the widget tree and
find all currently available handles. In this example the handles,
and some other object attributes, are displayed in a message. In a
real use environment the handle(s) would probably be assigned to a
variable and used to manipulate the widget in some fashion.


/* This procedure will walk the widget tree two layers deep.
Programmers can modify this program if they wish to determine
additional layers of widget handles.
*/

PROCEDURE TreeWalk :
DO:
DEF INPUT PARAMETER Grp AS WIDGET-HANDLE.
DEF INPUT PARAMETER IntFlag AS INT.

DEF VAR Flw AS WIDGET-HANDLE.

DO:
Flw=Grp:FIRST-CHILD.
DO WHILE (Flw<>?).
MESSAGE INTEGER(Grp) Grp:NAME Grp:TYPE SKIP
INTEGER(Flw) Flw:NAME Flw:TYPE SKIP
IntFlag.

CASE IntFlag:
WHEN 0 THEN RUN TreeWalk (Flw,1).
WHEN 1 THEN RUN TreeWalk (Flw,2).
END CASE.

Flw=Flw:NEXT-SIBLING.
END.
Grp=Grp:NEXT-SIBLING.
END.
END.
END PROCEDURE.


/* This segment can be used to call the TreeWalk proc the first time
and seed it with the handle of the object where you want to start
the walk.
*/
DO:
RUN TreeWalk (frame F-Main:FIRST-CHILD,0).
END.

Progress Software Technical Support Note # 15162