Operating Table Controls
When you set a table control to any mode other than indicator mode, you can use the keyboard or the mouse to navigate through the table and change the values in its cells.
A table has two distinct states of operation: selection state, which is the default state, and edit state. These states determine how LabWindows/CVI processes keyboard and mouse input. In the selection state, you can navigate through the table and select and/or make different cells active. In the edit state, you can change the value of a particular cell.
Selection State
When the table is in selection state, you can operate the table cells using the keyboard in the following ways:
- Press the left, right, up, or down arrow keys to change the active cell.
- Press <Home> to make the first cell in the current row the active cell.
- Press <End> to make the last cell in the current row the active cell.
- Press <Page Up> or <Page Down> to scroll the table up or down one page.
- Press <Ctrl-Home> to make the first cell from the first row the active cell.
- Press <Ctrl-End> to make the last cell from the last row the active cell.
- Press <Space> to operate a button cell if it is active.
- Press <Space> to view the pull-down list of values for combo box and ring cells if they are active.
You can select a range of cells by holding down the <Shift> key as you move the active cell. When you select a range of cells, you also can perform operations such as sorting, searching, copying, and pasting, on a group of cells.
You can use the mouse to select cells in the following ways:
- Click anywhere within the active cell to select it. Select a range of cells, including cells in multiple rows and columns, by holding down the left mouse button and dragging the mouse over the cells you want to select.
- Click a row label to select all the cells within that row. Click a column label to select all the cells within that column.
- Click the upper left corner of the table to select all the cells in the table.
Edit State
You can edit a cell only if it is not a picture cell, a ring cell, or a button cell; it is not dimmed; and it is not an indicator cell. Switch from selection to edit state by double-clicking an editable cell. If the active cell (the currently selected cell) can be edited, pressing <F2> also enables the edit state. If you enable ATTR_AUTO_EDIT, the table switches to edit state automatically when you begin to type into a cell. When the table is in edit mode, the active cell owns the keyboard focus, and this is the only cell you can edit.
Edit a string cell or combo box cell in the same way that you edit a text box control. Edit a numeric cell in the same way that you edit a numeric control. A numeric cell has optional up/down arrows that are visible only when you are editing the cell. You also can edit the cell by clicking these arrows.
![]() |
Note You can type multi-line text into combo box cells, but the text does not appear as multi-line in the pull-down list. |
When the table is in edit state, you can use the keyboard to change the cell that you are editing in the following ways:
- Press <Enter> to edit the cell immediately below the current cell. If the current cell is the last cell of its column, the active cell becomes the first cell of the next column. If the current cell is the last cell of the last column, the table reverts to selection state.
- Press <Shift-Enter> to edit the cell immediately above the current cell.
- Press <Tab> to edit the cell immediately to the right of the current cell.
- Press <Shift-Tab> to edit the cell immediately to the left of the current cell.
To use the mouse to select a cell for editing, double-click the cell you want to edit.
![]() |
Note You cannot edit picture cells, ring cells, or button cells. |
To return the table to selection state press <Esc> or click any cell other than the cell that you are editing. If you press <Esc>, the edits you made to the cell are not retained.
Row and Column Sizing
If you set the size mode of a row or a column to VAL_USE_EXPLICIT_SIZE, you can size that row or column by dragging the line that separates its label from the label of the next row or column. If you configure the table to not have visible row or column labels, you can still size its rows and columns by dragging the grid lines separating the cells themselves, but these lines have a much smaller sizing area than the lines that separate the row and column labels.
If you double-click a row or column separator while you size it, the row or column automatically sizes itself to the minimum size required to accommodate the numeric values, text, or images in all its cells.
You can disable row sizing and column sizing for the entire table programmatically.
Context Menu
If you right-click anywhere on the table control, you activate a menu that contains predefined items, as well as items you specify.
The following context menu items are predefined:
- Goto—Specify a target cell to move to, using its row and column indices.
- Find—Search all non-picture cells in the entire table, or in a selection range, for a text string. You also have the option to include the value list of ring and combo box cells in the search. After the initial search, you can press <F3> to find the next occurrence of the same text string, or you can press <Shift-F3> to search backwards for the previous occurrence of the text string.
- Sort—If you select a range of cells, sort the cells in the range using the data in one of the rows or columns as the sort key.
Copying and Pasting
When the table is in selection state, you can copy one or more cells to the clipboard. Press <Ctrl-C> to copy the selected cell(s). When the data appears in the system clipboard, the <Tab> ASCII character separates the data of each cell, and the linefeed ASCII character, <LF>, separates the data of each row.
LabWindows/CVI skips picture cells when it copies cells to the clipboard, with one exception: if you select a single picture cell, then its image contents are placed in the system clipboard as a bitmap. LabWindows/CVI does not copy or paste button and ring cells.
You can paste the contents of the system clipboard into a table control by pressing <Ctrl-V> after selecting the cell(s) into which you want to paste the data. LabWindows/CVI assumes that the <Tab> ASCII character separates the data that corresponds to each cell, and that the linefeed <LF> ASCII character separates the data corresponding to each row.
When the data in the clipboard includes an empty cell or cells, the paste operation makes no change to the corresponding cell (or cells) in the table that receives the new data. Similarly, when the data in the clipboard includes cells that contain data that cannot be converted to a valid number, the paste operation does not change to the corresponding cell (or cells) in the table that receives the new data.
If there is a bitmap image in the system clipboard and you want to paste it into a picture cell, select the cell and the press <Ctrl-V>.
Events
If the control mode of the table control is hot or validate, a commit event is generated when you change the value of a cell or when you press a button cell.
The table control also generates events when the active cell changes or the selection changes.