11-14-2012 10:47 PM
Hi,
I have a table in which i will be selecting a row but i dont want to see the row highlighted in the table.
please let me know how to remove the highlighting but still i want the row to be selected.
thank you
11-15-2012 05:54 PM
Hello Haneef,
Here is some quick code that will prevent most events from putting the table into the Selection State and keep it in the Edit State:
int CVICALLBACK ChangeColor (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_GOT_FOCUS:
SetCtrlAttribute (PANEL, PANEL_TABLE, ATTR_TABLE_RUN_STATE, VAL_EDIT_STATE);
break;
case EVENT_LOST_FOCUS:
SetCtrlAttribute (PANEL, PANEL_TABLE, ATTR_TABLE_RUN_STATE, VAL_EDIT_STATE);
SetCtrlAttribute (PANEL, PANEL_TABLE, ATTR_DIMMED, 1);
SetCtrlAttribute (PANEL, PANEL_TABLE, ATTR_DIMMED, 0);
break;
case EVENT_ACTIVE_CELL_CHANGE:
SetCtrlAttribute (PANEL, PANEL_TABLE, ATTR_TABLE_RUN_STATE, VAL_EDIT_STATE);
break;
case EVENT_SELECTION_CHANGE:
SetCtrlAttribute (PANEL, PANEL_TABLE, ATTR_TABLE_RUN_STATE, VAL_EDIT_STATE);
break;
case EVENT_TABLE_ROW_COL_LABEL_CLICK:
SetCtrlAttribute (PANEL, PANEL_TABLE, ATTR_TABLE_RUN_STATE, VAL_EDIT_STATE);
break;
case EVENT_RIGHT_CLICK:
SetCtrlAttribute (PANEL, PANEL_TABLE, ATTR_TABLE_RUN_STATE, VAL_EDIT_STATE);
return 1;
break;
case EVENT_KEYPRESS:
SetCtrlAttribute (PANEL, PANEL_TABLE, ATTR_TABLE_RUN_STATE, VAL_EDIT_STATE);
break;
}
return 0;
As you can see, I am swallowing the EVENT_RIGHT_CLICK because it is the only event that will put table in the Selection State. Please let me know if this works.
Regards,
Jeff L.