Consultor Eletrônico



Kbase P97996: How to scroll a frame so a specific button will come in the displayed area ?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/16/2008
Status: Verified

GOAL:

How to scroll a frame so a specific button will come in the displayed area ?

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x

FIX:

Create a dynamic fill-in at the button coordinates, apply 'entry' to that fill-in and after that delete the fill-in object. This will force the frame to scroll to the position of that button.

Example below will move a button in a frame and the frame will scroll following the button, so the button always remain in the visible area of the frame:
/*-------------*/
DEFINE BUTTON btn LABEL "Button" .
DEFINE VARIABLE whField AS WIDGET NO-UNDO.
DEFINE FRAME MyFrame WITH SIDE-LABELS.
ASSIGN
FRAME MyFrame:WIDTH-PIXELS=380
FRAME MyFrame:HEIGHT-PIXELS=320
FRAME MyFrame:SCROLLABLE=TRUE
FRAME MyFrame:VIRTUAL-HEIGHT-PIXEL=1000
FRAME MyFrame:BGCOLOR = 8.
.
ENABLE btn WITH FRAME MyFrame.
btn:Y=300.
btn:X=20.
VIEW FRAME MyFrame.
ON CHOOSE OF btn
DO:

btn:Y=btn:Y + 30.
DO:
CREATE FILL-IN whField
ASSIGN
ROW = btn:ROW
COLUMN = btn:COLUMN
FRAME = btn:FRAME
SENSITIVE = TRUE
VISIBLE = TRUE
.
whField:SENSITIVE = YES.
APPLY 'ENTRY' TO whField.
DELETE OBJECT whField.
END.
END.
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.
/*--------------*/