SetTableSelection
int SetTableSelection (int panelHandle, int controlID, Rect cellRange);
Purpose
Sets the cell selection of the specified table control.
If you set the cell selection to be nonempty, the table control sets its active cell to be the first cell in the new selection.
Selections can include hidden rows or columns within them. However, the selection edges must consist of visible edges. LabWindows/CVI shrinks selections with hidden rows or columns on its edges that you specify.
Supported Controls
You can use SetTableSelection with table 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. |
cellRange | Rect | A Rect structure specifying the new cell selection range. The Rect structure is defined as follows: typedef struct { int top; int left; int height; int width; } Rect; Pass the one-based row and column indices of the first cell in the selection as the top and left fields of the structure, respectively. Pass the number of columns in the selection as the width field of the structure, and the number of rows in the selection as the height field of the structure. If you want the selection to be empty, pass 0 as the width or the height. The macro VAL_EMPTY_RECT is convenient for this. The empty selection is the default state. You can create a Rect without declaring a variable by using the following function: Rect MakeRect (int top, int left, int height, int width); ExampleSetTableSelection (panelHandle, controlID, MakeRect (2, 3, 5, 5)); |
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 5.5 and later
Example
Refer to userint\colview.cws for an example of using the SetTableSelection function.