ScrollBar_Create

int ScrollBar_Create (int panelHandle, int controlTop, int controlLeft, int vertical, CtrlCallbackPtr callbackFunction, void *callbackData);

Purpose

This function creates a new scroll bar and returns a scroll bar ID used to specify the control in subsequent function calls.

Parameters

Input
Name Type Description
panelHandle integer The specifier for a particular panel that is currently in memory.

This handle will have been returned by the LoadPanel, NewPanel, or DuplicatePanel function.
controlTop integer The vertical coordinate at which the upper left corner of the control (not including labels) is placed.

The coordinate must be an integer value from –32768 to 32767.

The origin (0,0) is at the upper-left corner of the panel (directly below the title bar) before the panel is scrolled.
controlLeft integer The horizontal coordinate at which the upper left corner of the control (not including labels) is placed.

The coordinate must be an integer value from –32768 to 32767.

The origin (0,0) is at the upper-left corner of the panel (directly below the title bar) before the panel is scrolled.
vertical integer This value of this control specifies the orientation of the scroll:

True—the orientation is vertical

False—the orientation is horizontal

callbackFunction CtrlCallbackPtr The name of the user function that processes the scroll bar callback. This event function (type CtrlCallbackPtr) takes the form:

int CVICALLBACK ScrollBarCallback(int panel, int scrollBar, int event, void *callbackData, int eventData1, int eventData2);


The event function is passed the Panel Handle and Scroll Bar ID of the scroll bar generating the event. The Event type as well as Callback data defined by the user is passed to the event function as well. The new value of the scroll bar is also passed in the eventData1 parameter, and a pointer to this value is passed in the eventData2 parameter. The following is a list of each scroll bar action, the fired scroll bar event and a description of changes to the scroll bar.

Action Event Fired Description

up arrow click or keyboard up arrow EVENT_SB_UP_BUTTON value decreases by 1
down arrow click or keyboard down arrow EVENT_SB_DOWN_BUTTON value increases by 1
click above thumb and below up arrow or keyboard page up EVENT_SB_PAGE_UP value decreases by the view size
click below thumb and above down arrow or keyboard page down EVENT_SB_PAGE_DOWN value increases by the view size
dragging the mouse after thumb click EVENT_SB_THUMB_CHANGE values change based on thumb position
releasing the mouse after any click or keyboard event EVENT_SB_COMMIT no additional value change
keyboard home EVENT_SB_COMMIT value set to doc minimum
keyboard end EVENT_SB_COMMIT value set to doc maximum


Holding down the mouse button or the key causes any of the first four events to continue firing.

The eventData2 parameter can be cast to an integer pointer (int *) and then used to modify the scroll bar value in the callback function. The scroll bar thumb is moved to the modified location immediately after exiting the callback.
callbackData void * A pointer to user-defined data passed to the event function.

Return Value

Name Type Description
scrollBarID integer Returns the ID used to specify this scroll bar in subsequent function calls. Negative values indicate that an error occurred.
Return Values: xx Scroll Bar ID (success)
–1 General error, probably out of memory.
–2 Control ID is not a graph
–3 Bad attribute value
–4 Bad attribute