LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the coordinates of the last cell selected on a table by a callback generated by this one?

Hello,

I use a table to display several lines of datas.
I would like the operator to click on a line and display additional datas in a other table.

The problem is that when i generate a callback from a click on the table, the selected cell given by the GetActiveTableCell function is the previous selected cell. Same behaviour for a keypress event.
Why a double_click event (that i don't want tu use) do it fine?

Thank you

Daniel
0 Kudos
Message 1 of 3
(3,273 Views)

Take a look at this document:

http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3E8FF56A4E034080020E74861&p_...

As an alternative, I used this code to determine and hilight a row in a table when it is clicked on: you may start from this to develop your own application.

 switch (event) {
  case EVENT_LEFT_CLICK:
  case EVENT_RIGHT_CLICK:
   // Determine mouse position in the table
   GetTableCellFromPoint (panel, control, MakePoint (eventData2, eventData1), &cell);
   if (cell.x == 0 && cell.y == 0) return 1; // Not on a row/col
   GetNumTableRows (panel, control, &r);
   // Highlight the row
   SetTableSelection (panel, control, VAL_TABLE_ROW_RANGE (cell.y));

   // Other code here

   break;
 }



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 3
(3,264 Views)
Thank you for your answer,

I use these 2 lines:

GetTableCellFromPoint (panel, control, MakePoint (eventData2, eventData1), &Coord);
...
SetTableSelection (panel, control, VAL_TABLE_SINGLE_CELL_RANGE(Coord.y,Coord.x));


The second one also helps me for a problem of edit/select state in my table.
0 Kudos
Message 3 of 3
(3,233 Views)