LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

scrolling table mouse wheel

My UI contains a table that is initially empty.  When the app is launched I can mouse-over the table and use the mouse wheel to scroll through the (empty) table, but after the table is filled with values this functionality stops.  I can only scroll with the mouse wheel after left-click on the vertical scroll bar.  Any way to scroll the table without having to click the scroll bar?  Is there an attribute that can be set?

0 Kudos
Message 1 of 3
(3,905 Views)

Hello !

 

Here is how I did it (be careful, you will have to force "FirstVisibleRow" variable to be inside of limits [1 ; number of raw in the table]...this is not done in the example) :

int CVICALLBACK tableCB (int panel, int control, int event,
		void *callbackData, int eventData1, int eventData2)
{
	
	int FirstVisibleRow;
	
	switch (event)
	{
		// If mouse over the table => table is forced to be the active control of UI
		case EVENT_MOUSE_POINTER_MOVE:
			SetActiveCtrl (panelHandle, PANEL_TABLE);
			break;
		
		// If mouse wheel scroll is used 
		case EVENT_MOUSE_WHEEL_SCROLL:
			// Get first row index
			GetCtrlAttribute (panelHandle, PANEL_TABLE, ATTR_FIRST_VISIBLE_ROW, &FirstVisibleRow);
			// Set new first row index : scroll-down if eventData1 = 2 (scroll-up otherwise, if eventData1 = 3)
			SetCtrlAttribute (panelHandle, PANEL_TABLE, ATTR_FIRST_VISIBLE_ROW, (eventData1 == 2) ? FirstVisibleRow - 5 : FirstVisibleRow + 5);
			break;
	}
	return 0;
}

 

0 Kudos
Message 2 of 3
(3,893 Views)

What I said about limits is not precise enough, I should have said :

-> you will have to force "ATTR_FIRST_VISIBLE_ROW" attribute value to be inside of limits [1 ; number of raw in the table] before SetCtrlAttribute function executes.

0 Kudos
Message 3 of 3
(3,889 Views)