LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

SetTableSelection without loosing the collumn

Hi

I want to highlight the whole row when either cell is clicked on. This works with the below code

but i loose the collumn number. It is always 1

 

case EVENT_ACTIVE_CELL_CHANGE :

case EVENT_SELECTION_CHANGE   :

  GetActiveTableCell(panel,control,&cell);

  SetTableSelection(panel,control,MakeRect(row,1,1,9));

  break;

 

I would like to get the correct collumn when the event EVENT_LEFT_DOUBLE_CLICK is invoked

and then enable edeting the cell.

Anyone ?

Regards Per


 

0 Kudos
Message 1 of 5
(2,950 Views)

I don't think you can maintain the selection on the whole table row while editing a single cell in the row. What you can do is to change the background color of row cells with for example SetTableCellRangeAttribute (panelHandle, PANEL_TABLE, VAL_TABLE_ROW_RANGE (row), ATTR_TEXT_BGCOLOR, VAL_BLUE);

The problem will then be to correctly detect that the user has moved the focus to another row and move highlighting accordingly.



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 5
(2,940 Views)

Hi

The problem is that when I call

GetActiveTableCell(panel,control,&cell) it always returns 1 in cell.x

after the call to

SetTableSelection(panel,control,MakeRect(cell.y,1,1,9)); 

Thereby I have no longer acces to which collumn the click was made on.

 

What I want to do further then the the example code is to acces the correct cell on

the event EVENT_LEFT_DOUBLE_CLICK

Regards Per

0 Kudos
Message 3 of 5
(2,928 Views)

Per,

 

You can use the GetTableCellFromPoint function with the panel coordinates that are passed to the callback function:

 

GetTableCellFromPoint (panel, control, MakePoint(eventData2, eventData1), &cell);

 

Luis

0 Kudos
Message 4 of 5
(2,922 Views)

Well, it seems obvious, but...

 

What if you call GetActiveTableCell BEFORE selecting the row? As you can see in the help

 

If you set the cell selection to be nonempty, the table control sets its active cell to be the first cell in the new 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 5 of 5
(2,919 Views)