Progress
Programming
Handbook


Field-group Visibility and Scrolling

Figure 19–10 shows a spare field group. Progress allocates a spare field group if the number of visible iterations is less than the number of records that need to be displayed. At any given time, one of the foreground field groups in a down frame can be the spare. That is, the foreground field group can scroll off the screen.

The frame’s FIRST–CHILD/NEXT–SIBLING chain includes all of the field groups in the frame (including the spare). Its order is not affected by scrolling (see the "Accessing Field Groups" section).

However, the frame also has an GET–ITERATION( ) method, which along with the NUM–ITERATIONS attribute, simulates an array of all of the visible foreground field groups. Thus, if you want to find only the visible foreground field groups at any instant, you can use the GET–ITERATION( ) method with the NUM–ITERATIONS attribute.

The GET–ITERATION( ) method takes an integer argument n and, starting at the top of the frame, returns the widget handle of the field group that displays the nth visible iteration. You can access all of these field groups by using a loop that starts at one (GET–ITERATION(1)) and runs through the total number of visible iterations.

If the frame is named X, you can access the last visible iteration as follows:

GET-ITERATION(FRAME X:NUM-ITERATIONS) 

If you have a widget handle variable named X, you can access the last visible iteration as follows:

GET-ITERATION(X:NUM-ITERATIONS) 

As the frame scrolls, these attributes return different values. Thus, if an application wants to cycle through the visible iterations using the iteration loop, it should not do anything during the cycle that would scroll the frame.

This code fragment produces a frame with five visible iterations.

FOR EACH customer WITH 5 DOWN.
  DISPLAY cust-num name.
END. 

Before Progress executes the FOR EACH loop, NUM–ITERATIONS equals 0 (because Progress hasn’t created any field groups yet). The first time through the loop, after Progress displays the first cust–num and name, NUM–ITERATIONS equals 1. The second time through, NUM–ITERATIONS equals 2. Once Progress has displayed the fifth cust–num and name, NUM–ITERATIONS equals 5. The count will remain 5 until the frame is terminated. Note that after Progress starts scrolling, there will be 6 field groups—5 plus 1 spare (the spare will be different as the frame scrolls). The NUM–ITERATIONS attribute will stay at 5, but there will actually be 6 field groups.

Progress does not create new field groups (and all their underlying field-level widgets) as they are scrolled off the screen. Instead, it clears the existing field groups and then reuses them.

If an application uses the UNDERLINE statement, Progress uses one foreground field group to underline the fields in the field group directly above it. Also, if the application uses a DOWN statement to advance one or more iterations in the frame without displaying any data, Progress uses one of the foreground field groups to display a blank iteration. For example, this code fragment uses a DOWN statement to display a blank iterations.

REPEAT WITH FRAME a DOWN:
  FIND NEXT customer.
  DISPLAY cust-num name.
  DOWN 1 WITH FRAME a.
END. 

If you insert dynamic field-level widgets in a foreground field group of a down frame, you should be aware of the following defaults:

NOTE: Because of the complex nature of these defaults, PSC recommends that you do not place dynamic widgets in a foreground field group of a down frame.


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