07-13-2011 02:49 AM
Hello,
I wanted to make use of the EVENT_TABLE_ROW_COL_LABEL_CLICK event in sorting a table column, unfortunately it appears to be fired only for mouse left clicks and not for mouse right clicks (while the help says 'When a user clicks a row or column label...' -> probably it shoud read 'When a user right clicks a row or column label'?)
I need the EVENT_RIGHT_CLICK to use RunPopupMenu to show a custom Sort menu (the built-in Sort menu appears to only sort the selected column, which I find not very useful...) and was hoping to get the column index from the EVENT_TABLE_ROW_COL_LABEL_CLICK 😞
Yes, I have seen the example colview and its function GetClickedColumnLabel - it appears to be the only possibility?
Thanks!
Wolfgang
Solved! Go to Solution.
07-13-2011 12:02 PM
When thinking more about it it appears that I am looking for an event EVENT_TABLE_ROW_COL_LABEL_RIGHT_CLICK, hence I have suggested it here
07-18-2011 06:19 AM
Hi,
I was trying to find a way to somehow modify the EVENT_TABLE_ROW_COL_LABEL_CLICK but as you mentioned it only fires for left-clicks. The idea with the idea exchange is therefore the best way to proceed.
Regards, Jan
07-18-2011 06:30 AM
Thanks for confirmation, Jan!
07-11-2016 02:19 PM
Wolfgang, why not just call your callback function recursively upon the EVENT_RIGHT_CLICK event, passing the EVENT_TABLE_ROW_COL_LABEL_CLICK parameter. I do something like this often and get expected results. It would look something like:
int CVICALLBACK TableFunction (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { Point cell; int row, column; switch (event) { case EVENT_LEFT_CLICK: break; case EVENT_RIGHT_CLICK: /* eventData1 = mouse vertical pos., */ /* eventData2 = mouse horizontal pos. */ // extract mouse position in the table GetTableCellFromPoint(panel,control,MakePoint(eventData2,eventData1),&cell); column = cell.x; row = cell.y; // setup for sorting here TableFunction (panel, control, EVENT_TABLE_ROW_COL_LABEL_CLICK, void *callbackData, int row, int column); break; case EVENT_TABLE_ROW_COL_LABEL_CLICK: /* eventData1 = row, eventData2 = col */ // sorting stuff here break; case EVENT_COMMIT: break; } return 0; }