LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to change table column from indicator to hot?

Hello and sorry for this question, it sounds such basic... But after reading the help, the forum, and the examples I still did not find the answer... so your help is welcome...

 

In the UI editor, I have set up a table in indicator mode. Now, during run time, I'd like to change a given column to hot allowing the user to change the numeric values.

I have tried SetTableCellRangeAttribute ( ,, VAL_TABLE_COLUMN_RANGE ( 3 ), ATTR_CELL_MODE, VAL_HOT ) but it did not seem to have an effect (return value is 0).

I also added SetCtrlAttribute ( ,, ATTR_TABLE_RUN_STATE, VAL_EDIT_STATE ) but it did not help either.

 

What's the attribute I am missing here?

 

Thanks!

0 Kudos
Message 1 of 5
(3,166 Views)

I may be wrong, but it seems to me that you should set the whole control as HOT and set to indicator mode the columns you do not want the operator to modify.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 5
(3,164 Views)

Hi Roberto,

 

Actually I can't imagine you being wrong Smiley Wink

 

Still for some reason your suggestion does not yet yield the desired result: you are correct that setting the table control to hot using SetCtrlAttribute ( , ,ATTR_CTRL_MODE, VAL_HOT) permits to click on the table and edit the selected column, but as an undesired side effect it allows clicking on all other columns, too...

 

Is it not possible to separate allow clicking from allow editing?

 

Thanks,

Wolfgang 

0 Kudos
Message 3 of 5
(3,155 Views)

It's not easy to forbid clicking on a table cell. The easiest way to disable user interaction with some cells is to dim them using SetTableCellRangeAttribute (..., ..., ..., ATTR_CELL_DIMMED, 1); table aspect will bi dimmed, though, which can be undesirable.

 

Alternatively, I'm afraid your only option is to install a callback on the table and intercept mouse coordinated on click and double click events, this way:

 

int CVICALLBACK TableCallback (int panel, int control, int event,
		void *callbackData, int eventData1, int eventData2)
{
	Point	cell;

	switch (event) {
		case EVENT_LEFT_CLICK:
		case EVENT_LEFT_DOUBLE_CLICK:
			GetTableCellFromPoint (panel, control, MakePoint (eventData2, eventData1), &cell);
			if (cell.x != 3) return 1;
			break;
	}
	return 0;
}

 

This won't avoid that the user moves active cell with keyboard, so you will need to trap EVENT_KEYPRESS too and discriminate whether to allow moving or not based on direction of movement and active cell.

 



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 5
(3,148 Views)

Geez!

 

Indeed I don't want to dim columns because users should be able to easily read the contents. And you might have guessed it, your callback approach seems quite expensive to me. I guess it will be easier writing a product suggestion for NI Smiley Very Happy

 

Thanks anyway, may be I'l change my mind...

0 Kudos
Message 5 of 5
(3,145 Views)