LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

snap table scroll

In LabWindows/CVI 8.0, I want to provide a vertical scroll bar for my table, but I can't have partial rows showing at the top.  So, rather than allowing the table to scroll smoothly through every pixel, I need the scrolling to snap to the top of the nearest row.  Any advice?
 
Josh Moses
The Modal Shop
 
0 Kudos
Message 1 of 4
(3,226 Views)
Hello Josh,
 
you could use the following code each time the scroll bar is moved:
 
 GetCtrlAttribute (panel, table_id, ATTR_FIRST_VISIBLE_ROW, &first_row);
 SetCtrlAttribute (panel, table_id, ATTR_FIRST_VISIBLE_ROW, first_row);
 
Moving the scroll bar causes the table's callback funtion to be called, with the 'event' parameter set to EVENT_LEFT_CLICK. You can use the mouse coordinates (stored in eventData1 and eventData2) to check if the scroll bar got clicked.
0 Kudos
Message 2 of 4
(3,222 Views)

OK,

I figured out that the callback funtion is called before the scroll bar is moved. A possible solution would be enabling extended mouse events (EnableExtendedMouseEvents (panel, talbe_id, 0.010); ) and using EVENT_LEFT_MOUSE_UP instead of EVENT_LEFT_CLICK.

The scrolling will still be smooth, but as soon as the scroll bar is released, no partial row will be shown at the top of your table.

Message Edited by Wim S on 03-06-2006 05:23 PM

Message 3 of 4
(3,220 Views)

Excellent!  Thank you very much!

Josh

 

0 Kudos
Message 4 of 4
(3,212 Views)