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.

Parameters

Input
Name Type Description
panelHandle integer Specifier for a particular panel that is currently in memory. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel.
controlID integer 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 NewCtrl or 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 any type (passed by 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 integer Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Code Error Message String
xx Success