Consultor Eletrônico



Kbase 16000: Reopen browse query to exact record and viewport position
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/20/1998
Reopen browse query to exact record and viewport position

Note: this knowledgebase applies to browse widgets created in
Version 8 of PROGRESS and later. It does not apply to Version 7.

This example shows one way to reopen a browse query and reposition
to the same record as was selected previously, as well as position
the highlight of the record in the same viewport position as before.
This example uses a single-selection browse. Programmers are welcome
to customize this code for multi-selection browse widgets.

In other words, if the row of XXXXX's in the browse below signifies
the highlight bar of the browse, upon reopening this same query you
would want the same record ("Paris St Germain") to be selected *and*
positioned in the same place (9th row down) in the viewport.

+-------------------------------+
|Cust-num Name |
|-------------------------------|
| 6 Fanatical Athletes |
| 7 Aerobics valine KY |
| 8 Game Set Match | highlight bar in
| 9 Pihtiputann Pyora | 9th row of 11-row
| 10 Just Joggers Limited | browse viewport
| 11 Keilailu ja Biljardi | |
| 12 Surf Lautaveikkoset | |
| 13 Biljardi ja Tennis | |
|XXXXX 14 Paris St Germain XXXX| <----------/
| 15 Hoopla Basketball |
| 16 Thundering Surf Inc. |
+-------------------------------+


The code below accomplishes this using attributes and methods
available in browse widgets in Version 8 of PROGRESS and above. (This
technique is not possible on Version 7 browse widgets since the
SET-REPOSITIONED-ROW() method is not available on that version.)


DEF VAR i AS INT.
DEF VAR r AS ROWID.
DEF VAR stat AS LOGICAL.


/* When ready to reopen the query, first find out which record
is currently selected, using its ROWID. */

r = ROWID(customer).

/* Next, find out in which row of the browse viewport the highlight
bar is located. */

i = browse-1:FOCUSED-ROW.

/* (Or, alternatively....)

DO i = 1 TO browse-1:NUM-ITERATIONS:
IF browse-1:IS-ROW-SELECTED(i) THEN LEAVE.
END.

*/

/* Now reopen the query. */

OPEN QUERY browse-1 FOR EACH customer NO-LOCK.

/* Position the highlight bar to the proper record and to the
proper position in the viewport. */

stat = browse-1:SET-REPOSITIONED-ROW(i,"ALWAYS").
REPOSITION browse-1 TO ROWID r.

Progress Software Technical Support Note # 16000