LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetActiveTableCell does not seem to work.

In a callback function for the table under the event
EVENT_LEFT_CLICK I'm calling the function but it always
returns the row and column of the previous cell not the
cell that I have just clicked. Any ideas?
0 Kudos
Message 1 of 4
(3,473 Views)
Maybe the left click event is generated before the the table updates the 'active cell' pointer. Have you tried using EVENT_VAL_CHANGED instead of the let click?
Also, you could try inserting a ProcessDrawEvents () before retrieving the active cell: I personally haven't tried it, but this is fast and simple an attempt to do.

Hope this helps
Roberto


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 4
(3,473 Views)
You can also use GetTableCellFromPoint inside the EVENT_LEFT_CLICK callback as follows:

Point Mouse_Coords;
Point Cell;
Mouse_Coords.x = eventData2;
Mouse_Coords.y = eventData1;
GetTableCellFromPoint (panel, tableID, Mouse_Coords, &Cell);

The output "Cell" will now contain information about the most recently clicked cell; the row number as "y" and the column number as "x". eventData2 and eventData1 are passed through the callback by CVI as the mouse position. I too, struggled with trying to get the true active cell. Good luck.
Message 3 of 4
(3,473 Views)
Thanks for the help. I found another answer on the NI web site. It uses the PostDeferredCall function.
You use this function to call another callback and that
callback has the code that you would have put in the usual callback for the table. I downloaded the sample project files zip file from NI. I have attached the project files to this e-mail.
0 Kudos
Message 4 of 4
(3,473 Views)