kor Posted March 23, 2011 Share Posted March 23, 2011 (edited) expandcollapse popup#include <GUIListBox.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> Global $hListBox Global $var Local $hGUI ; Create GUI $hGUI = GUICreate("Create Staff Progress", 400, 296) $hListBox = _GUICtrlListBox_Create($hGUI, "", 2, 2, 396, 296, BitOR($LBS_NOSEL, $WS_VSCROLL)) GUISetState() ;MsgBox(4160, "Information", "Creating Staff") ; Add files ;_GUICtrlListBox_BeginUpdate($hListBox) _GUICtrlListBox_ResetContent($hListBox) _GUICtrlListBox_InitStorage($hListBox, 100, 4096) $num = 0 Do $num = $num + 1 _GUICtrlListBox_InsertString($hListBox, $num, -1) Sleep(100) Until $num > 30 ;_GUICtrlListBox_EndUpdate($hListBox) Sleep(1200) $var = False ; Loop until user exits Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE Or $var = False Is there a way to make this listbox auto scroll such that the newest number is always at the bottom, but you don't have to manually scroll? As the numbers populate, the listbox is automatically trying to scroll down so you always see the newest number? I realize I can change the InsertString from a -1 to 0 to have the numbers count upward with the highest number always being at the top, but I'm not a fan of that approach. EDIT: I'm also having a problem such that while the numbers are counting, it I attempt to close the GUI it will not close until the numbers have finished. Any idea why that is? Edited March 23, 2011 by kor Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 23, 2011 Moderators Share Posted March 23, 2011 kor, Hi again! Is there a way to make this listbox auto scroll such that the newest number is always at the bottomSend the list a message asking it to scroll to the end. if I attempt to close the GUI it will not close until the numbers have finishedBecause until the numbers have finished you never look for an event via GUIGetMsg - you need to check as the numbers are being inserted. Here is an amended Do...Until loop: Do $num = $num + 1 _GUICtrlListBox_InsertString($hListBox, $num, -1) ; Scroll to bottom of list $iCount = _SendMessage($hListBox, 0x18B, 0, 0) ; $LB_GETCOUNT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< _SendMessage($hListBox, 0x197, $iCount - 1, 0) ; $LB_SETTOPINDEX <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Sleep(100) If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit ; Look for the [X] being clicked <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Until $num > 30 Please ask if anything is unclear. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kor Posted March 23, 2011 Author Share Posted March 23, 2011 I can take from that code what you are doing and figure the rest out. Thank you! Link to comment Share on other sites More sharing options...
AutoBert Posted March 24, 2011 Share Posted March 24, 2011 (edited) Hi kor, here another way to scroll do actual insertet String:Do $num = $num + 1 _GUICtrlListBox_InsertString($hListBox, $num, -1) _GUICtrlListBox_SetCurSel($hListBox, $num -1) If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit Sleep(100) Until $num > 30 mfg autoBert Edited March 24, 2011 by AutoBert 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