Admin Production ni-theme
Current Publication

CanvasScroll

LabWindows/CVI

CanvasScroll

int CanvasScroll (int panelHandle, int controlID, Rect rectangle, 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.

Supported Controls

You can use CanvasScroll with canvas controls.

Parameters

Input
Name Type Description
panelHandle int Specifier for a particular panel that is currently in memory. You can obtain this handle from functions such as LoadPanel and NewPanel.
controlID int 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 functions such as NewCtrl and DuplicateCtrl.
rectangle 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 int 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 int 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 int Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Additional Information

Library: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later