ScrollBar_ConvertFromGraph

int ScrollBar_ConvertFromGraph (int panelHandle, int graphID, CtrlCallbackPtr callbackFunction, void *callbackData);

Purpose

This function converts a graph control created in the User Interface Editor to a scroll bar. The position, size and color of the graph are retained in the scroll bar. The defined constant (located in the UIR header file) which was assigned to the graph control in the User Interface Editor can then be used 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.
graphID integer The defined constant (located in the UIR header file) which was assigned to the graph control in the User Interface Editor.
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);


If the graph control being converted has a callback associated with it, pass 0 to use this callback function as the scrollbar's callback.

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
status integer Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Return Values: 0 Success
–1 General error, probably out of memory.
–2 Control ID is not a graph
–3 Bad attribute value
–4 Bad attribute