scriptcoder Posted November 29, 2008 Share Posted November 29, 2008 Hi all! I've added a ListBox to my GUI as a way to update the user as to what steps the application has already taken. I want to add a new "line" to the listbox everytime something significant happens. The problem I am having is that with too many "lines" the listbox does not scroll automatically to keep up with the lines but instead stays focused on the first set of "lines" Does anyone know how to make the listbox scroll automatically when the listbox is filled with lines? Sorry about my english I'm still learning.... Link to comment Share on other sites More sharing options...
Andreik Posted November 29, 2008 Share Posted November 29, 2008 Hi all!I've added a ListBox to my GUI as a way to update the user as to what steps the application has already taken. I want to add a new "line" to the listbox everytime something significant happens.The problem I am having is that with too many "lines" the listbox does not scroll automatically to keep up with the lines but instead stays focused on the first set of "lines" Does anyone know how to make the listbox scroll automatically when the listbox is filled with lines?Sorry about my english I'm still learning.... You need _GUICtrlListBox_GetCount() to get the number of lines from ListBox and _GUICtrlListBox_SetSel() to select the last item from list. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
scriptcoder Posted November 30, 2008 Author Share Posted November 30, 2008 Thank you for a quick reply Andreik. I cannot get it to work. I have the following to detect and change the listbox items.: CODE$numberofitems = _GUICtrlListBox_GetCount($List1) _GUICtrlListBox_SetSel($List1,$numberofitems) I feel like I'm missing something simple. Could you (or someone else) provide an example? Link to comment Share on other sites More sharing options...
rasim Posted November 30, 2008 Share Posted November 30, 2008 scriptcoderExample:#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <ScrollBarConstants.au3> $hGUI = GUICreate("Test", 300, 200) $ListBox = GUICtrlCreateList("", 10, 10, 280, 180) GUICtrlSetData($ListBox, _ "New string|New string|New string|New string|New string|New string|New string|New string|New string") GUISetState() AdlibEnable("_StringAdd", 1000) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE AdlibDisable() Func _StringAdd() GUICtrlSetData($ListBox, "New string|") GUICtrlSendMsg($ListBox, $WM_VSCROLL, $SB_LINEDOWN, 0) ;Scroll the ListBox control EndFunc ;==>_StringAdd Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now