Harabo Posted March 7, 2011 Share Posted March 7, 2011 Hello. I have made a little program now, and in the program i have a log function. And then im writning things to GuiCtrlCreatEdit. But when the text comes to the bottom, it wount scroll down it self. I need to use the mouse, and drag down the roller. How can i get this to scroll down automatic? Now the box look like this: $loggedit = GUICtrlCreateEdit("test", 10, 620,1180, 80,$ES_AUTOHSCROLL + $WS_VSCROLL + $ES_READONLY) And i am writing things to the edit by reading out what is there all ready, and pasting on a new line. Like this: $test = GuiCtrlRead($loggedit) $GuiCtrlSetData($loggedit, $test & @CRLF & "new lines..." How can i get it to automatic scroll down when it is filled with text? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 7, 2011 Moderators Share Posted March 7, 2011 Harabo,Just use _GUICtrlEdit_AppendText and it scrolls on its own: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #Include <GuiEdit.au3> $hGUI = GUICreate("Test", 500, 500) $hEdit = GUICtrlCreateEdit("", 10, 10, 480, 200, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY)) $hButton = GUICtrlCreateButton("Add Line", 10, 250, 80, 30) GUISetState() $iNextLine = 1 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton _GUICtrlEdit_AppendText($hEdit, "This is Line " & $iNextLine & @CRLF) $iNextLine += 1 EndSwitch WEndBy the way, note the use of BitOR to combine styles - the Setting Styles tutorial in the Wiki explains why you should do it this way. All clear? 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...
Harabo Posted March 7, 2011 Author Share Posted March 7, 2011 Harabo, Just use _GUICtrlEdit_AppendText and it scrolls on its own: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #Include <GuiEdit.au3> $hGUI = GUICreate("Test", 500, 500) $hEdit = GUICtrlCreateEdit("", 10, 10, 480, 200, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY)) $hButton = GUICtrlCreateButton("Add Line", 10, 250, 80, 30) GUISetState() $iNextLine = 1 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton _GUICtrlEdit_AppendText($hEdit, "This is Line " & $iNextLine & @CRLF) $iNextLine += 1 EndSwitch WEnd By the way, note the use of BitOR to combine styles - the Setting Styles tutorial in the Wiki explains why you should do it this way. All clear? M23 Thanks It did work perfect! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 7, 2011 Moderators Share Posted March 7, 2011 Harabo,Good. But when you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. 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...
Harabo Posted March 7, 2011 Author Share Posted March 7, 2011 Okok Havent search so much jet, but do you have a fast answer on how i get color on the text in the box? Tried with GUICtrlSetColor() but that didnt work :S Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 7, 2011 Moderators Share Posted March 7, 2011 Harabo, Tried with GUICtrlSetColor() but that didnt workThen you used it incorrectly - do this: $hEdit = GUICtrlCreateEdit("", 10, 10, 480, 200, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY)) GUICtrlSetColor($hEdit, 0xFF0000) That gives me red text. If you want different colours for different lines, then you need a RichEdit control - or you can use something like this that I wrote a while ago. 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...
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