Hello, i'm using CVI 9.0 and have a problem with table control.
I need to create a context menu item, which will run some code depending on cell, where right mouse button was clicked.
I tried to use NewCtrlMenuItem function to create new item, but i suppose there is no way to give cell coordinates to callback function fired by NewCtrlMenuItem.
Then i tried to fire table's callback function itself and use EVENT_RIGHT_CLICK, here is my code:
int CVICALLBACK DBTableRightClicked (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { Point cell; switch (event) { case EVENT_RIGHT_CLICK: GetTableCellFromPoint(grPanelHandle, GRPANEL_DB_TABLE, MakePoint(eventData1, eventData2), &cell); if (cell.x == 0 && cell.y == 0) return 1; SetActiveTableCell(grPanelHandle, GRPANEL_DB_TABLE, cell);
//here i wanted to create new context menu DebugPrintf("%i %i\n", cell.x, cell.y); break; } return 0; }
But for some reason my "cell" variable behaves very strange and does not correspond actual table cell coordinates, where i click right button.
Another problem is - the default context menu ("goto, find, next") is showing (but again, not every time) when i right click on my table.
So, i am very confused. Is there any way to handle this situation? I have no explanations, why such simple task becomes so difficult to implement in CVI.
Thanks for any help.