Deye Posted October 22, 2019 Share Posted October 22, 2019 (edited) what can be used to make the edit control display @LF 's when i paste text with line breaks with @LF 's in to it (even temporarily) the control starts of like so $idInput = GUICtrlCreateEdit("", $iLeft, 35, 720, 310, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL)) Thanks Edit: Pain in the neck: https://docs.microsoft.com/en-us/windows/win32/controls/em-fmtlines https://docs.microsoft.com/en-us/windows/win32/controls/edit-controls Edited October 23, 2019 by Deye Link to comment Share on other sites More sharing options...
Zedna Posted October 23, 2019 Share Posted October 23, 2019 Try @CRLF instead of @LF, it should work ... Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Deye Posted October 23, 2019 Author Share Posted October 23, 2019 (edited) Thanks Zedna I didn't explain the problem properly the reason i needed the edit control to display all soft breaks as @CRLF 's is that i needed this for both previewing but also copying from the edit control as a source with what i have tried, nothing will allow copying from the edit display control like it should for instance going and pasting it as a source into notepad (yields extra line breaks .. when using @CRLF 's instead) after all i don't think it will be possible to convert soft breaks to look like @CRLF in the edit control even if using a EditWordBreakProc ( .. not sure ) Edited October 23, 2019 by Deye Link to comment Share on other sites More sharing options...
jchd Posted October 24, 2019 Share Posted October 24, 2019 Not sure I get you, but if it's only for denoting LFs visually in the control, you can StringReplace @LF in the string by '¶' & @LF then set the result in the control. Of course if you want to copy-paste something from there, you'll need to StringReplace '¶' by '' after copying. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Nine Posted October 24, 2019 Share Posted October 24, 2019 @Deye It is not clear with is your issue. Maybe providing a snippet of your code and the way to replicate the problem your are facing could help us here to help you... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Deye Posted October 24, 2019 Author Share Posted October 24, 2019 (edited) In the end it was just a tricky matter of figuring out where @LF 's go and @CRLF 's I guess I didn't have much luck with first attempts so i got bewildered looking for other ways which eventually can get harder to accomplish as we know .. And suddenly voila: This will convert lines from the clipboard and back to a $var @ also displaying correctly the lines to the edit control and allowing copying from the edit control and pasting the lines as they look to another editor #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Example", 785, 400) $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) $idInput = GUICtrlCreateEdit("", 10, 10, 760, 310, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL)) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idOK GUICtrlSetData($idInput, "") _GetTextToVar() EndSwitch WEnd Func _GetTextToVar($sfile= ClipGet()) If Not ($sfile) Then Return Local $str = @CRLF & StringReplace($sfile, "'", "''") $str = StringStripCR($str) $str = StringRegExpReplace($str, '(.{1,100})', "& '$1' _" & @LF) $str = StringRegExpReplace($str, "\_\n{2}\& ", "_" & @CRLF & "& @LF & $1") $str = StringStripWS($str, 3) $Var = "$Var" $str = "Local " & $Var & " = '' _" & @CRLF & StringTrimRight($str, 2) $str = StringRegExpReplace($str, "\_\n{3,1000}", " & @LF & @CRLF" & @CRLF & $Var & ' = ') $str = StringReplace($str, $Var & " = &", $Var & " &=") GUICtrlSetData($idInput, $str) ClipPut($str) EndFunc ;==>_gefTextVar Thanks guys Edited October 24, 2019 by Deye Earthshine 1 Link to comment Share on other sites More sharing options...
Earthshine Posted October 24, 2019 Share Posted October 24, 2019 pretty neat @Deye Deye 1 My resources are limited. You must ask the right questions 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