From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to clear hilite from table control

Using CVI2010.

Panel has a tab with 6 pages with 2 tables each.

I want to display the panel initially with nothing highligted in the tables. Cannot find a way to do this.

I tried setting the selection to the empty rect but still seeing a single hilited cell:

    for (i=0; i<numTabs; ++i)
    {
        int table = tables[i*2];
        SetTableSelection (pages[i], table, VAL_EMPTY_RECT );
        table = tables[i*2+1];
        SetTableSelection (pages[i], table, VAL_EMPTY_RECT );
    }

I want the hiliting when the user selects something but not when the panel first displays.

 

0 Kudos
Message 1 of 9
(3,581 Views)

You can try using SetCtrlAttribute with ATTR_HIDE_HILITE attribute. I haven't tried it but the documentation seems to describe what you are looking for.



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 2 of 9
(3,571 Views)

Thank you very much for your reply but I believe that that attribute shuts off highlighting "permanently". I want highlighing but only when the user actively makes a selections. I don't want some random cell highlighted when the panel is first displayed.

0 Kudos
Message 3 of 9
(3,564 Views)

I'm afraid there is not a native function that does what you are looking  for. Keep in mind that every time the user clicks on the table, it makes a selection (even a single cell clicked becomes a selection: a one-cell selection area).

You can probably install a calback on the table control and intercept some of the events received by the control (EVENT_LEFT_CLICK, EVENT_SELECTION_CHANGE or others you can think of). In the table control you can switch that attribute on and off.



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 9
(3,553 Views)

The cell is highlighted before the user has selected anything. And even after setting the selection rect to empty the cell is still highlighted.

0 Kudos
Message 5 of 9
(3,546 Views)

Aren't you confusing the selection highlighting with active cell evidence?

A table has an active cell even if there is no selection.



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 6 of 9
(3,539 Views)

Maybe. I thought active cell was indicated by outline as in attached picture.

 

0 Kudos
Message 7 of 9
(3,528 Views)

You must also consider whether the table is the active control or not: the thin rectangle is the evidence of either a selection or the active cell when the table is not the active control. See this picture:

 

Tables.png

 



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 8 of 9
(3,524 Views)

If you don't want the thin rectangle hilighting when the table is not the active control, you could use the ATTR_HIDE_HILITE attribute, as Roberto suggested. But, instead of setting that attribute just once, you could turn it on and off, depending on whether the table has the focus or not. For example, in the table callback you could do the following:

 

switch (event)
{
   case EVENT_GOT_FOCUS:
      SetCtrlAttribute (panel, PANEL_TABLE, ATTR_HIDE_HILITE, 0);
      break;
   case EVENT_LOST_FOCUS:
      SetCtrlAttribute (panel, PANEL_TABLE, ATTR_HIDE_HILITE, 1);
      break;
}

 

Luis

0 Kudos
Message 9 of 9
(3,476 Views)