ahha Posted July 4, 2024 Posted July 4, 2024 Is there a setting for interpreting @CR as @CRLF ? Perhaps in a GUICtrlCreateEdit style option? or maybe option for _SetText or _AppendText? I ask because if you run the program you see _GUICtrlEdit_SetText and _GUICtrlEdit_GetText handle them differently. _GUICtrlEdit_GetText always treats it a @CRLF I guess I could always preprocess @CR, @LF, and @LFCR into @CRLF before using _SetText or _AppendText Thanks for any hints, ahha _GUICtrlEdit_SetText question.au3
Solution Andreik Posted July 4, 2024 Solution Posted July 4, 2024 Don't be tricked by what you see, everything works as expected, you get exactly what you set (convert the string returned by _GUICtrlEdit_GetText() to binary if you want to be sure). If you want a different end of line character and you have at least Win 10 then look at EM_GETENDOFLINE and EM_SETENDOFLINE.
ioa747 Posted July 5, 2024 Posted July 5, 2024 (edited) expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <MsgBoxConstants.au3> Example() ;modified from _GUICtrlEdit_SetText example Func Example() Local $idEdit ; Create GUI GUICreate("Edit Set Text", 400, 300) GUISetFont(11, 400, 0, "Courier New") $idEdit = GUICtrlCreateEdit("", 2, 2, 394, 268) GUISetState(@SW_SHOW) Local $sTxt = "" $sTxt &= "A @CRLF test" & @CRLF & "After @CRLF" & @CRLF $sTxt &= "A @CR test" & @CR & "After @CR test" & @CRLF $sTxt &= "A @LF test" & @LF & "After @LF test" & @CRLF $sTxt &= "~~~~~~~~~~~~~~~~~~~~~~~~" & @CRLF _GUICtrlEdit_SetText($idEdit, $sTxt) ConsoleWrite("$sTxt=" & $sTxt & @CRLF) ConsoleWrite("****************************" & @CRLF) MsgBox($MB_SYSTEMMODAL, "Information 1", $sTxt) _GUICtrlEdit_AppendText($idEdit, @CRLF) _GUICtrlEdit_AppendText($idEdit, _GUICtrlEdit_GetText($idEdit)) ConsoleWrite(_GUICtrlEdit_GetText($idEdit)) MsgBox($MB_SYSTEMMODAL, "Information 2", _GUICtrlEdit_GetText($idEdit)) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example https://www.autoitscript.com/forum/topic/150872-how-to-post-code-on-the-forum/ Edited July 5, 2024 by ioa747 I know that I know nothing
ahha Posted July 5, 2024 Author Posted July 5, 2024 @Andreik - you are correct. Sorry to waste your time. I had checked the input in a hex editor but not the output I did get fooled by what I saw. @ioa747 - noted.
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