PvS1 Posted August 15, 2012 Posted August 15, 2012 Hi, I am a happy user of autoIT. I created a program that uses a logging window. I used: create: GUICreate() add line: GUICtrlSetData() This works OK, once the window is full a scrolbar appears and lines are added. I experience 1 problem: Once the window is full and the scrolbar appears I no longer see the latest logging. To see the latest logging I need to manipulate the scrolbar with my mouse manually. What do I need to do to cause the most recently sent logging line to show automatically? Kind regards, PvS1
PhoenixXL Posted August 16, 2012 Posted August 16, 2012 This Should help LINKPlease give the full code My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
Moderators Melba23 Posted August 16, 2012 Moderators Posted August 16, 2012 PvS1, Welcome to the AutoIt forum. This should show you the method to use: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ScrollBarConstants.au3> $hGUI = GUICreate("Test", 320, 500) $hList = GUICtrlCreateList("", 10, 10, 310, 150) GUISetState(@SW_SHOW) GUICtrlSetData($hList, "1st message timed at " & @MIN & ":" & @SEC) ; Start a timer to simulate messages arriving $iBegin = TimerInit() ;Loop to keep GUI polling While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch ; Every second If TimerDiff($iBegin) > 1000 Then GUICtrlSetData($hList, "New message timed at " & @MIN & ":" & @SEC) ;Scroll the list control GUICtrlSendMsg($hList, $WM_VSCROLL, $SB_LINEDOWN, 0) ; Reset the timer $iBegin = TimerInit() EndIf WEnd Please ask if you have any questions. 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
Zedna Posted August 17, 2012 Posted August 17, 2012 Mine modification of Melba's one: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ScrollBarConstants.au3> #include <GUIListBox.au3> $hGUI = GUICreate("Test", 320, 500) $hList = GUICtrlCreateList("", 10, 10, 310, 150, BitOR($LBS_NOTIFY,$LBS_NOSEL,$WS_HSCROLL,$WS_VSCROLL,$WS_BORDER)) GUISetState(@SW_SHOW) Logging("1st message timed at " & @MIN & ":" & @SEC) ; Start a timer to simulate messages arriving $iBegin = TimerInit() ;Loop to keep GUI polling While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch ; Every second If TimerDiff($iBegin) > 1000 Then Logging("New message timed at " & @MIN & ":" & @SEC) ; Reset the timer $iBegin = TimerInit() EndIf WEnd Func Logging($text) _GUICtrlListBox_BeginUpdate($hList) $index = _GUICtrlListBox_AddString($hList, $text) _GUICtrlListBox_SetTopIndex($hList, $index) _GUICtrlListBox_UpdateHScroll($hList) ; to correct size of horiz scrollbar for texts with big width _GUICtrlListBox_EndUpdate($hList) EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search
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