aa2zz6 Posted January 4, 2017 Share Posted January 4, 2017 (edited) For the GUICtrlCreateEdit I thought there was a way to clear all text inside but I can't seem to find the resource on how to do this. And when the program is running and new text is added is it possible to show the new stuff instead of the old? The GUICtrlCreateEdit doesn't scroll down to the new. This is how I currently have it set to. $log = GUICtrlCreateEdit("", 20, 40, 460, 400, BitOR($ES_WANTRETURN, $ES_READONLY, $ES_AUTOVSCROLL, $WS_VSCROLL)) Edited January 4, 2017 by aa2zz6 Link to comment Share on other sites More sharing options...
kylomas Posted January 4, 2017 Share Posted January 4, 2017 aa2zz6, Write noting to the edit control like this... #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <date.au3> #AutoIt3Wrapper_Add_Constants=n Local $gui010 = GUICreate('Edit Example') $log = GUICtrlCreateEdit("", 20, 40, 360, 300) Local $btn010 = GUICtrlCreateButton('Clear', 20, 360, 360, 20) GUISetState() AdlibRegister('Write_Log', 100) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $btn010 GUICtrlSetData($log, '') ; <----- clear the log EndSwitch WEnd ; fill the log up to show scrolling Func Write_Log() GUICtrlSetData($log, _NowCalc() & @CRLF, 1) EndFunc ;==>Write_Log Most of the styles you specify are already defaults... kylomas aa2zz6 1 Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
aa2zz6 Posted January 4, 2017 Author Share Posted January 4, 2017 (edited) Thanks kylomas Would there be anyway to allow the new text to appear as it's being recorded? Currently it's stuck at the top and doesn't scroll down with the new text. I check for a style to allow this and there was nothing from what I could see. Edited January 4, 2017 by aa2zz6 Link to comment Share on other sites More sharing options...
Subz Posted January 4, 2017 Share Posted January 4, 2017 #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <ScrollBarsConstants.au3> #include <date.au3> #AutoIt3Wrapper_Add_Constants=n Local $gui010 = GUICreate('Edit Example') $log = GUICtrlCreateEdit("", 20, 40, 360, 300) Local $btn010 = GUICtrlCreateButton('Clear', 20, 360, 360, 20) GUISetState() AdlibRegister('Write_Log', 100) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $btn010 GUICtrlSetData($log, '') ; <----- clear the log EndSwitch WEnd ; fill the log up to show scrolling Func Write_Log() GUICtrlSetData($log, _NowCalc() & @CRLF, 1) $iEnd = StringLen(GUICtrlRead($gui010)) _GUICtrlEdit_SetSel($gui010, $iEnd, $iEnd) _GUICtrlEdit_Scroll($gui010, $SB_SCROLLCARET) EndFunc ;==>Write_Log Link to comment Share on other sites More sharing options...
kylomas Posted January 5, 2017 Share Posted January 5, 2017 (edited) aa2zz6, subz, F.Y.I, SetSel is Not required. The third parm of GuiCtrlSetData ensures that the caret (insertion point) is always at the end... #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <ScrollBarsConstants.au3> #include <date.au3> #AutoIt3Wrapper_Add_Constants=n Local $gui010 = GUICreate('Edit Example') $log1 = GUICtrlCreateEdit("", 20, 40, 170, 300) $log2 = GUICtrlCreateEdit("", 210, 40, 170, 300) Local $btn010 = GUICtrlCreateButton('Clear', 20, 360, 360, 20) GUISetState() AdlibRegister('Write_Log', 100) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $btn010 GUICtrlSetData($log1, '') ; <----- clear the logs GUICtrlSetData($log2, '') ; <----- clear the logs EndSwitch WEnd ; fill the log up to show scrolling Func Write_Log() GUICtrlSetData($log1, _NowCalc() & @CRLF, 1) GUICtrlSetData($log2, _NowCalc() & @CRLF, 1) ;$iEnd = StringLen(GUICtrlRead($gui010)) ;_GUICtrlEdit_SetSel($gui010, $iEnd, $iEnd) ;_GUICtrlEdit_Scroll($log1, $SB_SCROLLCARET) EndFunc ;==>Write_Log kylomas edit: None of the scrolling is required. Edited January 5, 2017 by kylomas Clarification Subz and aa2zz6 2 Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill 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