A script-enabled browser is required for this page to function properly.

SCROLL_VIEW Built-in

Description

Moves the view to a different position on its canvas by changing the Viewport X Position on Canvas and Viewport Y Position on Canvas properties. Moving the view makes a different area of the canvas visible to the operator, but does not change the position of the view within the window.

Note: For a content or toolbar canvas, the window in which the canvas is displayed represents the view for that canvas. For a stacked canvas, the view size is controlled by setting the Viewport Width and Viewport Height properties.

Syntax

PROCEDURE SCROLL_VIEW
(view_id ViewPort,
x
NUMBER,
y
NUMBER);

PROCEDURE SCROLL_VIEW
(view_name VARCHAR2,
x
NUMBER,
y
NUMBER);

Built-in Type unrestricted procedure

Enter Query Mode yes

Parameters

view_id 
 
Specifies the unique ID that Oracle Forms assigns the view when it creates the object. Use the FIND_VIEW Built-in to return the ID to an appropriately typed variable. The data type of the ID is ViewPort.
 
view_name 
 
Specifies the name that you gave the object when defining it. The data type of the name is VARCHAR2.
 
 
x 
Specifies the x coordinate of the view's upper left corner relative to the upper left corner of the canvas.
 
y 
Specifies the y coordinate of the view's upper left corner relative to the upper left corner of the canvas.

SCROLL_VIEW Examples

/*
** Built-in: SCROLL_VIEW
** Example: Scroll the view whose name is passed in 10% to
** the right or left depending on the 'direction'
** parameter.
*/
PROCEDURE Scroll_Ten_Percent( viewname VARCHAR2,
direction VARCHAR2 ) IS
vw_id ViewPort;
vw_wid NUMBER;
vw_x NUMBER;
cn_id Canvas;
cn_wid NUMBER;
ten_percent NUMBER;
new_x NUMBER;
old_y NUMBER;
BEGIN
/*
** Get the id's for the View and its corresponding canvas
*/
vw_id := Find_View( viewname );
cn_id := Find_Canvas( viewname );

/*
** Determine the view width and corresponding canvas
** width.
*/
vw_wid := Get_View_Property(vw_id,WIDTH);
cn_wid := Get_Canvas_Property(cn_id,WIDTH);
/*
** Calculate how many units of canvas width are outside of
** view, and determine 10% of that.
*/
ten_percent := 0.10 * (cn_wid - vw_wid);
/*
** Determine at what horizontal position the view
** currently is on the corresponding canvas
*/
vw_x:= Get_View_Property(vw_id,VIEWPORT_X_POS_ON_CANVAS);
/*
** Calculate the new x position of the view on its canvas
** to effect the 10% scroll in the proper direction.
** Closer than ten percent of the distance to the edge
** towards which we are moving, then position the view
** against that edge.
*/
IF direction='LEFT' THEN
IF vw_x > ten_percent THEN
new_x := vw_x - ten_percent;
ELSE
new_x := 0;
END IF;
ELSIF direction='RIGHT' THEN
IF vw_x < cn_wid - vw_wid - ten_percent THEN
new_x := vw_x + ten_percent;
ELSE
new_x := cn_wid - vw_wid;
END IF;
END IF;
/*
** Scroll the view that much horizontally
*/
old_y := Get_View_Property(vw_id,VIEWPORT_Y_POS_ON_CANVAS);
Scroll_View( vw_id, new_x , old_y );
END;