LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I set a listbox to the very bottom entry?

In LW5.0, I'm using a listbox to keep a visual and readily accessible record of the statistics for the tests that have completed. It is updated as the data is calculated.

The problem I have is that it stays at the very top of the list so the user cannot see the newest information because it's at the bottom (and they would have to scroll down). If a ProcessSystemEvents() is called then they can scroll down the list but whenever the list is updated it gets set back to the top again. The list is updated every 1-2s.

How can I get the list box to stay on the bottom entry??? Thanks for the help!
0 Kudos
Message 1 of 2
(2,864 Views)
It's very easy. You just set the List Box index to the last item with SetCtrlIndex. Like this:

GetNumListItems (panelHandle, PANEL_LISTBOX, &count);
SetCtrlIndex (panelHandle, PANEL_LISTBOX, count-1);

First you get the Number of Items in the list (if you don't already have it in a variable), then you set the list box index to that value minus 1 (zero-based). That will cause the list to select and display the last entry.

Best Regards,

Chris Matthews
National Instruments
Message 2 of 2
(2,864 Views)