Progress
Programming
Handbook


Defining a Single- or Multiple-select Browse

A browse can support single and multiple selections. By default, a browse is single select. The MULTIPLE option sets up a multiple-select browse. Multiple selection allows you to select any combination of rows from the browse, which you can then access using the appropriate browse attributes and methods.

In a multiple-select read-only browse, a user clicks each row to select it. Selecting a second row does not deselect the previous row. In a multiple-select updatable browse, there are two ways to select multiple records. First, a user can click on one row marker, hold down the mouse button and drag to select multiple contiguous rows. Second, a user can hold down the CTRL key and click on any row marker to toggle its selection state. Rows selected in this manner do not have to be contiguous. Clicking a row marker without holding down CTRL selects that row and deselects all other selected rows. Note also, that the CTRL click feature only operates on row markers, not on disabled columns in updatable browse widgets.

NOTE: For a multiple-select browse in character interfaces, selection of each row is toggled by the space bar. The close angle bracket (>) indicates each selected row. The same technique applies to both read-only and updatable multiple-select browse widgets.

For a multiple-select browse, the concepts of focus and selection separate. Selection indicates that the user has selected a record. There can be many selected records. The last selected record is in the one in the record buffer. Focus indicates that the record has input focus. There can be only one focused row, and it might or might not be a selected row. In a single-select browse, selection and focus are one and the same.

NOTE: When a browse is initialized, the buffer contains the first record in the query, since no record has been selected by the user. To keep the browse in sync with the query, the buffer contains the first record in the browse viewport while there is no selected record.

Note that an updatable browse can only have one selected row when it is in edit mode. So, if the user selects five rows and then an updatable cell, the four rows that do not contain the active cell are deselected. The code example below shows a simple multiple-select browse:

p-br03.p
DEFINE QUERY q1 FOR customer SCROLLING. 
DEFINE BROWSE b1 QUERY q1 DISPLAY cust-num name credit-limit balance 
    ENABLE credit-limit WITH 10 DOWN SEPARATORS MULTIPLE 
    TITLE "Update Credit Limits". 
DEFINE FRAME f1 
    b1 
        WITH SIDE-LABELS ROW 2 CENTERED NO-BOX.  
OPEN QUERY q1 FOR EACH customer NO-LOCK. 
ENABLE ALL WITH FRAME f1. 
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW. 

When you run this example, the following browse appears:

Browse Selection and Query Interaction

A browse can support either a single selection or multiple selections. The last selected row of the browse always becomes the current row of the query. In a multiple-select browse, if you deselect the current row, the query is repositioned to the currently selected row that was last selected. If no rows are selected, the query is repositioned to the first record in the viewport.

Table 10–1 summarizes how actions on the browse affect the associated query.

Table 10–1: Browse and Query Interaction 
Browse Action
Effect on Query
Vertical keyboard navigation
Moves results list cursor for single-select browse widgets.
Select row
Put record(s) for that row into the record buffer(s).
Deselect current row
If other records are selected in the browse, put record(s) for the most recently selected of those rows into the record buffer(s). Otherwise, reposition to the first row in the viewport.
Deselect non-current row
None.

Using the GET statement to navigate within the results list of the query has no effect on the browse. However, the REPOSITION statement does update the current position of the browse. If you use GET statements for a query on which a browse is defined, you should use the REPOSITION statement to keep the browse synchronized with the query. Also, when you open or reopen the query with the OPEN QUERY statement, the browse is positioned to the first record.


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