10-10-2013 11:22 AM
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?
10-11-2013 07:25 AM
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; }
10-11-2013 07:49 AM
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.