Consultor Eletrônico



Kbase P48582: How to reopen browse query to exact record and viewport position?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   09/12/2010
Status: Verified

GOAL:

How to reopen browse query to exact record and viewport position?

GOAL:

How to reposition the highlight bar to the proper record?

GOAL:

How to reposition the highlight bar to the proper position in the viewport?

FIX:

The code below accomplishes this using attributes and methods
available in browse widgets:

DEFINE VARIABLE i AS INTEGER.
DEFINE VARIABLE r AS ROWID.
DEFINE VARIABLE f AS INTEGER.

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

r = ROWID(customer).

/* Find out in which row of the browse viewport the highlight
bar is located. */

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. */

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