Hi.
I made a program using the table related function. But I couldn't use the SetTableRowAttribute function in my program.
What's the problem ?.
Please check it and let me know it.
Thank you.
---------------------------------------------
#include
#include "tabletest.h"
#include
static int panelHandle;
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "\\jangwork\\test2\\tabletest.uir", PANEL)) < 0)
return -1;
DisplayPanel (panelHandle);
RunUserInterface ();
DiscardPanel (panelHandle);
return 0;
}
int CVICALLBACK tabletestfunc (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
Point Cell;
int NumOfColumn;
int numRows;
int rowNum;
switch (event)
{
case EVENT_LEFT_CLICK:
GetNumTableRows (panel, control, &numRows);
for (rowNum = 1; rowNum <= numRows; rowNum++)
{
if (rowNum % 2)
{
SetTableCellRangeAttribute (panel, control,
VAL_TABLE_ROW_RANGE(rowNum),
ATTR_TEXT_BGCOLOR,0x999966L);
}
else
{
SetTableCellRangeAttribute (panel, control,
VAL_TABLE_ROW_RANGE(rowNum),
ATTR_TEXT_BGCOLOR,0xCCCC99L);
}
}
SetTableCellVal(panel,control,MakePoint(1,1),1);
GetTableCellFromPoint (panelHandle, PANEL_TABLE_DEFECTS,
MakePoint(eventData2, eventData1), &Cell);
printf(" PanelCoordX=%d PanelCoordY=%d Cell of X=%d Y=%d\n",eventData2,eventData1,Cell.x,Cell.y);
SetCtrlVal (panelHandle, PANEL_NUM_COLUMN, Cell.x);
SetCtrlVal (panelHandle, PANEL_NUM_ROW, Cell.y);
GetNumTableColumns (panel, control, &NumOfColumn);
SetTableCellRangeAttribute(panel, control, MakeRect(Cell.y, 1, 1, NumOfColumn), ATTR_TEXT_BGCOLOR,VAL_RED); // It works well.
// SetTableRowAttribute(panelHandle, PANEL_TABLE_DEFECTS, Cell.y, ATTR_TEXT_BGCOLOR,VAL_RED); // It doesn't work. Why ?????????
break;
}
return 0;
}
int CVICALLBACK Quit (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
QuitUserInterface (0);
break;
}
return 0;
}