Progress
Programming
Handbook


Dynamic Enhancements to the Static Browse

You can now dynamically create some or all of the columns for a static browse by using the ADD–COLUMNS–FROM( ), ADD–LIKE–COLUMN( ) and ADD–CALC–COLUMN( ) methods. If you use the ADD–COLUMNS–FROM( ) or ADD–LIKE–COLUMNS( ) methods on a static browse, the browse becomes a NO–ASSIGN browse and you will have to manage the database updates manually. See "Using the Browse Widget," for more information on the static browse.

In addition, you can now change the query of a static browse even if the underlying fields are not the same as those of the original query. However, if the new underlying fields are not the same as the original, all browse columns will be removed and you will have to specify new columns using the new ADD–COLUMNS–FROM( ), ADD–LIKE–COLUMN( ) and ADD–CALC–COLUMN( ) methods. If the QUERY attribute is set to the UNKNOWN value (?), all browse–columns are removed.

The following code example depicts an updateable static browse with all dynamic columns:

p-stbrw1.p 
DEFINE BUTTON btn-quit LABEL "&Quit" AUTO-ENDKEY.
DEFINE VARIABLE i AS INTEGER.
DEFINE VARIABLE ColHandle AS HANDLE.
DEFINE QUERY q1 FOR customer SCROLLING.
OPEN QUERY q1 FOR EACH customer NO-LOCK.

DEFINE BROWSE StaticBrowse
  QUERY q1
       WITH TITLE "A Static Browse with Dynamic Columns"
       MULTIPLE
       SEPARATORS
       SIZE 104 BY 10. 

DEFINE FRAME f1
    StaticBrowse SKIP(2)
    btn-quit AT ROW 13 COLUMN 3
    WITH THREE-D SIZE 105 BY 15 .

CURRENT-WINDOW:ROW = 1.
CURRENT-WINDOW:HEIGHT-CHARS = 16.
CURRENT-WINDOW:WIDTH-CHARS = 107.
CURRENT-WINDOW:TITLE = "A Static Browse with All Dynamic Columns".
CURRENT-WINDOW:KEEP-FRAME-Z-ORDER = TRUE.

StaticBrowse:READ-ONLY = FALSE.
StaticBrowse:ROW-MARKERS = TRUE.

StaticBrowse:ADD-LIKE-COLUMN("customer.state").
StaticBrowse:ADD-LIKE-COLUMN("customer.postal-code").
StaticBrowse:ADD-LIKE-COLUMN("customer.address").
StaticBrowse:ADD-LIKE-COLUMN("customer.address2").
StaticBrowse:ADD-LIKE-COLUMN("customer.terms").

REPEAT i=2 TO StaticBrowse:NUM-COLUMNS:
    ColHandle = StaticBrowse:GET-BROWSE-COLUMN(i).
    ColHandle:READ-ONLY = FALSE.
END.

ON CHOOSE OF btn-quit DO:
    APPLY "window-close" TO CURRENT-WINDOW.
END.

ENABLE ALL WITH FRAME F1.
WAIT-FOR CLOSE OF CURRENT-WINDOW. 


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