SCROLL_VIEW Built-in
SCROLL_VIEW Built-in 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.
=====================================================
/*
** 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;=====================================================
Download the fmb file from this link :-
=====================================================
/*
** 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;
Download the fmb file from this link :-
0 comments:
Post a Comment