LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting/highlighting a complete row in a table

I would like to highlight/select a complete row in a table when user
left clicks on a cell. How can I do it. I would prefer to do this where
user can not edit the table, so table will be "indicator".


vishi
0 Kudos
Message 1 of 3
(3,816 Views)
Vishi,

In the LEFT_CLICK event, use the function GetTableCellFromPoint to determine which cell the user clicked on (keep inmind that he might have clicked on an area of the table which does not correspond to a cell: make sure both coordinates of the cell are non-zero).

Once you have the cell, just highlight the entire row of that cell, using the function SetTableSelection, passing it VAL_TABLE_ROW_RANGE(r) as the range (where r is the 1-based index of the row).

If the table is NOT an indicator, you will have to swallow the event, so that further processsing of the event by the table does not undo your selection change.

Luis Gomes
NI
Message 2 of 3
(3,816 Views)
Thanks Luis,

vishi

Luis Gomes wrote:
> Vishi,
>
> In the LEFT_CLICK event, use the function GetTableCellFromPoint to
> determine which cell the user clicked on (keep inmind that he might
> have clicked on an area of the table which does not correspond to a
> cell: make sure both coordinates of the cell are non-zero).
>
> Once you have the cell, just highlight the entire row of that cell,
> using the function SetTableSelection, passing it
> VAL_TABLE_ROW_RANGE(r) as the range (where r is the 1-based index of
> the row).
>
> If the table is NOT an indicator, you will have to swallow the event,
> so that further processsing of the event by the table does not undo
> your selection change.
>
> Luis Gomes
> NI
0 Kudos
Message 3 of 3
(3,816 Views)