Consultor Eletrônico



Kbase P124206: How to reposition a CHUI browse based on user keystroke
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/19/2007
Status: Unverified

GOAL:

How to reposition a CHUI browse based on user keystroke?

GOAL:

Sample code for repositioning a character based 4GL browse?

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x
Windows
Unix

FIX:

DEF TEMP-TABLE ttCustomer
FIELD custNum AS INTEGER
FIELD NAME AS CHARACTER
INDEX ix IS PRIMARY UNIQUE
custNum .

DEF VAR vi AS INT.

REPEAT vi = 1 TO 100:
CREATE ttCustomer.
ASSIGN custNum = vi
name = CHR(vi + 32) + STRING(vi).
END.

DEFINE BUTTON b1 LABEL "Ok".

DEFINE QUERY q FOR ttCustomer.

DEFINE BROWSE b QUERY q DISPLAY custNum NAME WITH SIZE 60 BY 12.

DEFINE FRAME f b SKIP b1 WITH WIDTH 80.

ON 'choose':U OF b1 IN FRAME f
DO:
APPLY 'CLOSE' TO FRAME f.
RETURN NO-APPLY.
END.

ON ANY-PRINTABLE OF b IN FRAME f
DO:
/* locate first record where name begins with the keystroke letter */
FIND FIRST ttCustomer WHERE NAME BEGINS key-label( LASTKEY ) NO-LOCK NO-ERROR.
/* reposition the underlying query */
IF AVAILABLE( ttcustomer ) THEN
DO:
REPOSITION q TO ROWID ROWID( ttCustomer ) .
QUERY q:GET-NEXT().
END.
RETURN NO-APPLY.
END.
OPEN QUERY q FOR EACH ttCustomer.

ENABLE b b1 WITH FRAME f.

VIEW FRAME f.

WAIT-FOR CLOSE OF FRAME f.