الأربعاء، ٢٨ أكتوبر ٢٠٠٩

SCROLL_VIEW

الـ SCROLL_VIEW Built-in تقوم بتحريك الـ View فى الـ Canvas التى بها على حسب الاتجاه المحدد فى معامل الـ X و الـ Y ، و يؤدى ذلك بدوره الى أظهار بعض المناطق من الـ Canvas التى كانت مخفية الى الـ End User ، و لكنه فى نفس الوقت لا يغير من وضع - Position - الـ View بالنسبة للـ Window.

هذا الأجراء يظهر كيفية أستخدام الـ SCROLL_VIEW Built-in




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


و هذا الرابط به التنفيذ العملى fmb file للكود السابق ذكره

أضــــــــــــــــــــــــــــــغـــــــــــــــــــــــــط هـــــــــــــــــــــــــــــــــــــنا

Share/Save/Bookmark

0 comments:

إرسال تعليق

Newer Posts Older Posts Home Page