Admin Production ni-theme
Current Publication

SetTableCellVal

LabWindows/CVI

SetTableCellVal

int SetTableCellVal (int panelHandle, int controlID, Point cell, ...);

Purpose

Sets the value of a table control cell to the specified value.

Note   This function updates the displayed value immediately. Use SetTableCellAttribute with ATTR_CTRL_VAL to set the control value without immediately updating the displayed value. Because of the difference in behavior, SetTableCellAttribute with ATTR_CTRL_VAL is generally faster than SetTableCellVal. However, if the table control in which you set the cell value is the active control in the panel, SetTableCellAttribute with ATTR_CTRL_VAL displays the value immediately.

Supported Controls

You can use SetTableCellVal 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.
cell Point A Point structure specifying the cell for which you want to set the value.

The Point structure is defined as follows:

typedef struct
{
int x;
int y;
} Point;


Pass the one-based column index of the cell in the x field of the structure, and the one-based row index of the cell in the y field of the structure.

You can create a Point without having to declare a variable by using the following function:

Point MakePoint (int x, int y);

Example

SetTableCellVal (panelHandle, controlID, MakePoint (2, 3), value);

value ... The new value of the cell.

The value that this function expects depends on the cell type of the specified cell.

If the cell type is VAL_CELL_PICTURE, the function expects an ID of the bitmap containing the new image. The ID must be a value obtained from NewBitmapEx, GetBitmapFromFile, GetCtrlBitmap, ClipboardGetBitmap, GetCtrlDisplayBitmap, GetPanelDisplayBitmap, GetScaledPanelDisplayBitmap, GetScaledCtrlDisplayBitmap, or DuplicateBitmap.

A value of 0 indicates that there is no image. You can use this to delete an existing image.

If the cell type is VAL_CELL_STRING, VAL_CELL_RING, VAL_CELL_COMBO_BOX, or VAL_CELL_BUTTON, the function expects a NUL-terminated string.

If the cell type is VAL_CELL_RING it will remain unchanged unless the value you specify matches an existing value in the cell's value list.

If the cell type is VAL_CELL_NUMERIC, the function expects a number of a data type matching the data type of the cell.

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

Examples

Refer to the following examples that use the SetTableCellVal function:

  • userint\colview.cws

    Open example
  • userint\databinding.cws

    Open example
  • userint\tablecells.cws

    Open example
  • utility\threading\ThreadPool\ParallelTestInit\ParallelTestInit.cws

    Open example