CanvasScroll

int CanvasScroll (int panelHandle, int controlID, Rect scrollRect, int scrollAmountInXDirection, int scrollAmountInYDirection);

Purpose

Scrolls the contents of a specific rectangular area of a canvas control. The area that is exposed by the scrolling is filled using the current value of the ATTR_PEN_FILL_COLOR attribute. The contents of the canvas outside the rectangular area are not affected.

Parameters

Input
Name Type Description
panelHandle integer Specifier for a particular panel that is currently in memory. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel.
controlID integer The defined constant, located in the .uir header file, that you assigned to the control in the User Interface Editor, or the ID returned by NewCtrl or DuplicateCtrl.
scrollRect Rect Rect structure that specifies the location and size of the rectangular area to scroll. Use VAL_ENTIRE_OBJECT to specify the entire canvas.

The area of the canvas outside the specified rectangle is not affected by the scrolling.

The Rect structure is defined as follows:

typedef struct
   {
   int top;
   int left;
   int height;
   int width;
   } Rect;


You can create a Rect without having to declare a variable by using the following function:

Rect MakeRect (int top, int left, int height, int width);

Example

CanvasScroll (panelHandle, controlID, VAL_ENTIRE_OBJECT, xScrollAmount, yScrollAmount, 1);

scrollAmountInXDirection integer Amount to scroll horizontally.

A positive value for scrollAmountInXDirection moves the contents of the rectangle to the right. An area on the left side of the rectangle is exposed. The area is filled with the current value of the ATTR_PEN_FILL_COLOR attribute.

A negative value for scrollAmountInXDirection moves the contents of the rectangle to the left. An area on the right side of the rectangle is exposed. The area is filled with the current value of the ATTR_PEN_FILL_COLOR attribute.
scrollAmountInYDirection integer Amount to scroll vertically.

A positive value for scrollAmountInYDirection moves the contents of the rectangle down. An area at the top of the rectangle is exposed. The area is filled with the current value of the ATTR_PEN_FILL_COLOR attribute.

A negative value for scrollAmountInYDirection moves the contents of the rectangle the up. An area at the bottom of the rectangle is exposed. The area is filled with the current value of the ATTR_PEN_FILL_COLOR attribute.

Return Value

Name Type Description
status integer Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Code Error Message String
xx Success