Create a dynamic browse
- Last Updated: May 1, 2024
- 4 minute read
- OpenEdge
- Version 13.0
- Documentation
The most complex graphical object is the browse object. You can create a browse dynamically and specify programmatically all its attributes, including what table and query’s records are displayed, what columns it displays, which columns are enabled for input, and its visible attributes such as size and position.
You can assign most of a dynamic browse’s attributes in the CREATE
BROWSE statement:
|
In addition, you can specify some attribute values individually following the
CREATE statement:
|
Here are some of the principal attributes you can set either in the CREATE
BROWSE statement or in a separate assignment on the browse handle:
FRAME— You must associate the browse with a frame it is visualized in.XandY, orROWandCOLUMN— You should specify a position for the browse. Otherwise, it is positioned in the upper-left corner of the frame. As for other objects,XandYare in pixels,ROWandCOLUMNare in character rows.WIDTHorWIDTH-PIXELS— You should specify a width for the browse using theWIDTHattribute in characters or theWIDTH-PIXELSattribute in pixels.HEIGHT,HEIGHT-PIXELSorDOWN— You should specify a height for the browse using either the characterHEIGHTorHEIGHT-PIXELSattribute or theDOWNattribute.DOWNspecifies the number of rows to display. Keep in mind that if you use theHEIGHTorHEIGHT-PIXELSattribute, then any horizontal scrollbar uses part of that height. The overall height of the browse remains the same whether there is a horizontal scrollbar or not. If you specifyDOWN, that determines the number of rows of data to display, and any horizontal scrollbar is added to that height.ROW-HEIGHT— Set this decimal attribute if you want each row to be different from the default, which is calculated based on the font.SENSITIVE— You should generally make a browse sensitive so that the user can use the scroll bar.QUERY— You must provide the browse with the handle of a query that provides its data to display.VISIBLEorHIDDEN— You must set eitherHIDDENto false, if you want the browse to be viewed when its parent frame if viewed, orVISIBLEto true to force the frame and the browse to be viewed.READ-ONLY— Set this option to true if you are not going to enable columns in the browse.SEPARATORS— Set this option to true if you want lines between the columns and rows of the browse.ROW-MARKERS— Set this option to false if you do not want row markers at the beginning of each row.NO-VALIDATE— Set this option to true to prevent ABL from compiling field-level validation phrases from the schema into the browse.TITLE— Set this string if you want the browse to have a title bar.MULTIPLE— Set this option to true if you want to enable multiple selection of rows.
Some attributes can only be assigned before the browse is realized. In the case of a dynamic browse, this is generally when the browse is made visible, which you can do in one of two ways:
- By setting its
VISIBLEattribute to true, which forces its containing frame to be viewed - By setting its
HIDDENattribute to false, which views the browse when its parent frame is viewed
In a CREATE BROWSE statement, the attributes of the browse in the
ASSIGN list are assigned in sequence. So, as this single statement
is executed, if the AVM encounters the VISIBLE = TRUE or HIDDEN
= FALSE phrases (and its parent frame is visible), the browse is realized
at that time. If you try to assign an attribute later in the statement, or in a separate
statement, which has to be assigned before the browse is realized, you get an error at
run time. For example, if you do not want the browse to have row markers at the
beginning of each row, you set the ROW-MARKERS attribute to FALSE. If
you put this assignment into the CREATE statement after an attribute
that realizes the browse, you get the error shown:
If this occurs, you have to reorder the assignments in the CREATE BROWSE
statement. Generally, you should put the assignment that realizes the browse at the end
of the statement or in a separate attribute assignment statement.
In the same way, you can modify most attributes in separate statements after the browse
has been realized, except for attributes such as ROW-MARKERS.