Likurg Posted March 2, 2010 Share Posted March 2, 2010 (edited) Hello! I have an edit box ( GUICtrlCreateEdit ), and I am logging there programm actions. I made it read-only, but user still can place a caret there. I need to append text to this edit box and scroll it down to the end, so user could see last logs. I tried two options, first one is: GUICtrlSetData($statusTextField, @CRLF & "Build started", 1) in this case everything works fine, until user will place a caret in different place on the edit box, so the text will be inserted there, not to the end. The other options is: GUICtrlSetData($statusTextField, GUICtrlRead(statusTextField) & @CRLF & "Build started") In this case last logs are always appended to the end, but edit box is not scrolled down. Any help would be highly appreciated! Edited March 2, 2010 by Likurg Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 2, 2010 Moderators Share Posted March 2, 2010 Likurg, This will place the caret at the end of the current text and scroll down to bring it into view: expandcollapse popup#include <GUIConstantsEx.au3> #include <EditConstants.au3> #Include <GUIEdit.au3> #Include <ScrollBarConstants.au3> $sText = "Line 1" & @CRLF & _ "Line 2" & @CRLF & _ "Line 3" & @CRLF & _ "Line 4" & @CRLF & _ "Line 5" & @CRLF & _ "Line 6" & @CRLF & _ "Line 7" & @CRLF & _ "Line 8" & @CRLF & _ "Line 9" $hGUI = GUICreate("Test", 500, 500) $hEdit = GUICtrlCreateEdit($sText & @CRLF & $sText & @CRLF & $sText, 10, 10, 200, 200, BitOr($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) $hButton = GUICtrlCreateButton("Add", 10, 250, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton $iEnd = StringLen(GUICtrlRead($hEdit)) _GUICtrlEdit_SetSel($hEdit, $iEnd, $iEnd) _GUICtrlEdit_Scroll($hEdit, $SB_SCROLLCARET) GUICtrlSetData($hEdit, @CRLF & "New line inserted", 1) EndSwitch WEnd I hope it is what you wanted. M23 simplercoder000 and Xandy 1 1 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...
Likurg Posted March 2, 2010 Author Share Posted March 2, 2010 Yep, Big tnx Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 2, 2010 Moderators Share Posted March 2, 2010 Likurg, Sorry, I forgot to add that you can put the caret anywhere in the text and it will still add the new text at the bottom. 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...
Likurg Posted March 2, 2010 Author Share Posted March 2, 2010 (edited) Ok. Tnx) Edited March 2, 2010 by Likurg Link to comment Share on other sites More sharing options...
playlet Posted March 2, 2010 Share Posted March 2, 2010 (edited) --- Edited August 18, 2016 by playlet Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 2, 2010 Moderators Share Posted March 2, 2010 playlet,Sorry, but that is not what the OP wanted. In your script you can place the caret in the existing word and the new information is inserted at that point. What the OP wanted was to ensure that the new test was added at the end and visible - hence the moving of the caret to the end with _GUICtrlEdit_SetSel and then scrolling down with _GUICtrlEdit_Scroll.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...
playlet Posted March 2, 2010 Share Posted March 2, 2010 (edited) --- Edited August 18, 2016 by playlet Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 2, 2010 Moderators Share Posted March 2, 2010 Playlet,No problem. My old maths teacher used to say before every exam: "READ THE QUESTION!". I still try and follow his advice - although I am the first to admit that I do not do so every time. 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...
Rogue5099 Posted March 14, 2012 Share Posted March 14, 2012 (edited) I'm having the same issue here. Here is a test script to append text to the end of a Edit Control. All it is doing is overwriting the line again and again. expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GUIEdit.au3> #Include <ScrollBarConstants.au3> GUICreate("Test", 803, 502, 192, 124, $WS_POPUPWINDOW) $Edit = GUICtrlCreateEdit("", -1, -1, 823, 509, BitOR($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY)) GUISetState(@SW_SHOW) GUICtrlSetBkColor($Edit, 0x000000) GUICtrlSetColor($Edit, 0x00ff00) $Inventory = _FileListToArray_Recursive(@ScriptDir & "", '*', 1, 2, True) For $i = 1 To (UBound($Inventory) -1) $iEnd = StringLen(GUICtrlRead($Edit)) _GUICtrlEdit_SetSel($Edit, $iEnd, $iEnd) _GUICtrlEdit_Scroll($Edit, $SB_SCROLLCARET) GUICtrlSetData($Edit, @CRLF & $Inventory[$i]) Next While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func _FileListToArray_Recursive($sPath, $sFilter = "*", $iRetItemType = 0, $iRetPathType = 0, $bRecursive = False) Local $sRet = "", $sRetPath = "" $sPath = StringRegExpReplace($sPath, "[/]+z", "") If Not FileExists($sPath) Then Return SetError(1, 1, "") If StringRegExp($sFilter, "[/ :> <|]|(?s)As*z") Then Return SetError(2, 2, "") $sPath &= "|" $sOrigPathLen = StringLen($sPath) - 1 While $sPath $sCurrPathLen = StringInStr($sPath, "|") - 1 $sCurrPath = StringLeft($sPath, $sCurrPathLen) $Search = FileFindFirstFile($sCurrPath & $sFilter) If @error Then $sPath = StringTrimLeft($sPath, $sCurrPathLen + 1) ContinueLoop EndIf Switch $iRetPathType Case 1 ; relative path $sRetPath = StringTrimLeft($sCurrPath, $sOrigPathLen) Case 2 ; full path $sRetPath = $sCurrPath EndSwitch While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop If ($iRetItemType + @extended = 2) Then ContinueLoop $sRet &= $sRetPath & $File & "|" WEnd FileClose($Search) If $bRecursive Then $hSearch = FileFindFirstFile($sCurrPath & "*") While 1 $File = FileFindNextFile($hSearch) If @error Then ExitLoop If @extended Then $sPath &= $sCurrPath & $File & "|" WEnd FileClose($hSearch) EndIf $sPath = StringTrimLeft($sPath, $sCurrPathLen + 1) WEnd If Not $sRet Then Return SetError(4, 4, "") Return StringSplit(StringTrimRight($sRet, 1), "|") EndFunc ;==> Melba23's _FileListToArray_Recursive Edit: Nevermind forgot to add ", 1)" at end of GUICtrlSetData($Edit, @CRLF & $Inventory[$i]) Edited March 14, 2012 by rogue5099 My projects: Inventory / Mp3 Inventory, Computer Stats Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 14, 2012 Moderators Share Posted March 14, 2012 (edited) Rogue5099, You are missing a vital parameter: GUICtrlSetData($Edit, @CRLF & $Inventory[$i], 1) ; <<<<<<<<<<< See it now? M23 Edit: That recursive search function has been much improved by the way - the latest version is in my sig. Edited March 14, 2012 by Melba23 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...
Rogue5099 Posted March 14, 2012 Share Posted March 14, 2012 #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GUIEdit.au3> #Include <ScrollBarConstants.au3> #include <RecFileListToArray.au3> $Inventory = _RecFileListToArray(@UserProfileDir & "\", "*", 1, 1, 1, 0) GUICreate("Test", 473, 502, -1, -1, $WS_POPUPWINDOW) $Edit = GUICtrlCreateEdit("", -1, -1, 823, 509, BitOR($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY)) GUISetState(@SW_SHOW) GUICtrlSetBkColor($Edit, 0x000000) GUICtrlSetColor($Edit, 0x00ff00) For $i = 1 To (UBound($Inventory) -1) $iEnd = StringLen(GUICtrlRead($Edit)) _GUICtrlEdit_SetSel($Edit, $iEnd, $iEnd) _GUICtrlEdit_Scroll($Edit, $SB_SCROLLCARET) GUICtrlSetData($Edit, @CRLF & $Inventory[$i], 1) Next While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Thanks for the update on your RFLTA. Now I am guessing there is a cap on Edit box? How would I go around that? to list infinite characters? Let's just take above for example. Most data is stored in UserProfileDir (picture, music, TEMP FILES) caped Temp Files cause there are a lot usually. I know that you can exclude with your new UDF but I just want to know if you can increase Edit Box or use something else to list infinite number of characters. My projects: Inventory / Mp3 Inventory, Computer Stats Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 14, 2012 Moderators Share Posted March 14, 2012 Rogue5099,Windows limits edit controls to about 32k characters by default - you can increase this by using GUICtrlSetLimit. I have no idea what the absolute max value is but it is certainly not infinite. 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...
Rogue5099 Posted March 14, 2012 Share Posted March 14, 2012 (edited) GUICtrlSetLimit works up to 10,000,000 characters lol. Thanks!Also I love your Updated RFLTA speed!!! That's almost 3 files scanned within a millisecond! Edited March 14, 2012 by rogue5099 My projects: Inventory / Mp3 Inventory, Computer Stats Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 14, 2012 Moderators Share Posted March 14, 2012 Rogue5099,I love your Updated RFLTA speedThanks - I normally get complaints that it is too slow! 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