LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable table cell highlight?

I have recently upgraded from LabWindows CVI 5.5.1 to 7.1, and I notice that my tables will load up with a cell highlighted (outlined with a blue border). This did not occur in 5.5.1. Is there a way to disable this?

Thanks, Jason
0 Kudos
Message 1 of 8
(5,893 Views)
Jason,

There isn't a clean way of disabling the outline, but you can still do it, in a sort of roundabout way.

The outline only appears when the control does not have the focus (when it does have the focus, it shows a solid selection, same is it did in 5.5). The outline will not appear if the table is in edit mode (ATTR_TABLE_RUN_STATE = VAL_EDIT_STATE). Because the run state does not matter when the table does not have the focus, you can take advantage of this by toggling the run state whenever the table loses the focus.

Try adding the following code to the table's callback:

case EVENT_GOT_FOCUS:
SetCtrlAttribute (panel, control, ATTR_TABLE_RUN_STATE, VAL_SELECT_STATE);
break;
case EVENT_LOST_FOCUS:
SetCtrlAttribute (panel, control, ATTR_TABLE_RUN
_STATE, VAL_EDIT_STATE);
SetCtrlAttribute (panel, control, ATTR_DIMMED, 1);
SetCtrlAttribute (panel, control, ATTR_DIMMED, 0);
break;

You might be wondering why the code is dimming and undimming the table. That's just a little trick to force the table to redraw itself after the attribute change (which is sometimes needed when the attribute change coincides with the control losing focus).


By the way, this callback code only "fixes" the problem when the user changes the focus after the panel has been loaded. If you want to also take care of the problem when the panel is first displayed, because you know that the table does not start out as the active control, then you also need to add this line to your initialization code:

SetCtrlAttribute (panel, control, ATTR_TABLE_RUN_STATE, VAL_EDIT_STATE);

Let me know if this doesn't make sense.

Luis
NI
0 Kudos
Message 2 of 8
(5,893 Views)
Luis,

Thanks for the reply. I tried the above, but the outlines still persist. I should have mentioned that these tables were originally created in CVI 5.5.1 (now they are being operated in CVI 7.1), and they are set to VAL_INDICATOR operation mode. I have two tables on the same panel, and when the panel is loaded, they both have an outlined cell no matter if they do/don't have focus or are in edit/select state.

Jason
0 Kudos
Message 3 of 8
(5,892 Views)
I see. Well, yeah that does change things. Actually, as I think about it, I believe the table should not outline the active cell when it's in indicator mode. So we'll treat this as a bug and fix it for the next version.

In the meanwhile, your options are pretty limited. There is one possible option, but I'm not sure if it will be workable for you:

Since the table is an indicator, it doesn't really matter which is the active cell. I don't know how many rows and columns your table has, but if there is a manageable number of one or the other, such that you have no need for a scrollbar in at least one of the directions, you could add an empty row (or column) just outside of view, and make one of the cells in that row (or column) be the active cell.
If you also hide the corresponding scroll bar, then the user will never know about this empty row, and so you can "hide" the active cell.

I apologize for the inconvenience. I wish we had caught this earlier...

- luis
0 Kudos
Message 4 of 8
(5,892 Views)
Luis,

Thanks for helping out. I think that I can implement your last suggestion, but I am glad that this will be slated for correction in future versions.

Jason
0 Kudos
Message 5 of 8
(5,892 Views)

Has this been fixed for Version 8.0?

This fix works for me after the table losses focus, but does not work for me when the table is first loaded.

0 Kudos
Message 6 of 8
(5,644 Views)
John,

The change I was referring to earlier was made for CVI 8.0. That is, tables that are in indicator mode do not display an outline around the active cell.

Luis
0 Kudos
Message 7 of 8
(5,623 Views)
Ok, maybe Labwindows 8 doesn't outlight cells when table is set as "indicator", but in this case it's not possible to use the wheelmouse to scroll through the rows 😞
0 Kudos
Message 8 of 8
(5,521 Views)