LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

EVENT_TABLE_ROW_COL_LABEL_CLICK only for left clicks?

Solved!
Go to solution

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

Message 1 of 5
(3,157 Views)
Solution
Accepted by topic author Wolfgang

When thinking more about it it appears that I am looking for an event EVENT_TABL​E_ROW_COL_​LABEL_RIGHT_CLIC​K, hence I have suggested it here

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

Hi,

 

I was trying to find a way to somehow modify the  EVENT_TABL​E_ROW_COL_​LABEL_CLIC​K 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

0 Kudos
Message 3 of 5
(3,134 Views)

Thanks for confirmation, Jan!

0 Kudos
Message 4 of 5
(3,132 Views)

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;
}
			
0 Kudos
Message 5 of 5
(2,865 Views)