Progress
Programming
Handbook


Accessing Field Groups

Different applications may want to access all of the field groups in a frame, the foreground field groups, or the visible foreground field groups. The following examples show how an application can access these different field groups.

Example 1

This example shows how an application might access all of the field groups (and their field-level widgets and child frames) in a frame.

DEFINE VARIABLE GRP AS WIDGET-HANDLE.  /* the field group */
DEFINE VARIABLE FLW AS WIDGET-HANDLE.  /* the field-level widget */

GRP = FRAME FRX:FIRST-CHILD.
DO WHILE (GRP <> ?).
  FLW = GRP:FIRST-CHILD.
  DO WHILE (FLW <> ?). /* loop through field-level widgets in
                          field-group */

    /* insert code here to access the widget */
    
    FLW = FLW:NEXT-SIBLING.
  END.
  GRP = GRP:NEXT-SIBLING.
END.  

This example uses the frame’s FIRST–CHILD/NEXT–SIBLING chain to access all of the field groups, field-level widgets, and child frames in frame FRX (including the spare field group, if one exists). FLW is set to each sibling field-level widget and child frame of the frame. Note that the order in which this loop accesses the field groups is not connected with the order in which the field groups are displayed on screen.

NOTE: This example does not access any widgets parented by child frames. To accomplish that requires a recursive version of this procedure.

Example 2

This example shows how an application might access all of the foreground field groups (and their field-level widgets and child frames) in a frame.

DEFINE VARIABLE GRP AS WIDGET-HANDLE.  /* the field group */
DEFINE VARIABLE FLW AS WIDGET-HANDLE.  /* the field-level widget */

GRP = FRAME FRX:FIRST-CHILD.
DO WHILE (GRP <> ?).
  IF (GRP:FOREGROUND) THEN DO:
    FLW = GRP:FIRST-CHILD.
    DO WHILE (FLW <> ?). /* loop through field-level widgets in 
                         field-group */

      /* insert code here to access the widget */

      FLW = FLW:NEXT-SIBLING.
    END.
  END.
  GRP = GRP:NEXT-SIBLING.
END.  

This example uses the frame’s FIRST–CHILD/NEXT–SIBLING chain and the FOREGROUND attribute to access all of the foreground field groups, field-level widgets, and child frames in frame FRX (including the spare field group, if one exists).

NOTE: This example does not access any widgets parented by child frames. To accomplish that requires a recursive version of this procedure.

Example 3

This example shows how an application might access all of the visible foreground field groups (and their field-level widgets) in a down frame.

DEFINE VARIABLE IDX AS INTEGER.       /* index of visible iterations */
DEFINE VARIABLE GRP AS WIDGET-HANDLE. /* the field-group */
DEFINE VARIABLE FLW AS WIDGET-HANDLE  /* the field-level widget */

DO IDX = 1 TO FRAME FRX:NUM-ITERATIONS:
  GRP = FRAME FRX:GET-ITERATION(IDX).
  FLW = GRP:FIRST-CHILD.
  DO WHILE (FLW <> ?). /* loop through field-level widgets in 
                          field-group */

    /* insert code to access the widget */

    FLW = FLW:NEXT-SIBLING.
  END.
END. 

This example uses the frame’s FIRST–CHILD/NEXT–SIBLING chain and the GET–ITERATION( ) method to access all of the foreground widgets in the visible field groups frame FRX.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095