mike1950r Posted May 12, 2023 Share Posted May 12, 2023 Hi, how can i display .xcu content in richedit control. If i load the file, only a part of the content is displayed in one line. in notepad i can display complete automaticly making lines, in notepad++ i can display complete content in one line in word i can display the content devided in lines, but no way in richedit control. what have i to do ? thanks for advice. cheers mike PS. and xcu file is attached registrymodifications.xcu Link to comment Share on other sites More sharing options...
pixelsearch Posted May 12, 2023 Share Posted May 12, 2023 As your file size is > 32KB, did you try _GUICtrlRichEdit_SetLimitOnText ? Link to comment Share on other sites More sharing options...
pixelsearch Posted May 12, 2023 Share Posted May 12, 2023 Concerning the 1 line part, there is no 0D/0A in the whole file, so you got 2 options : 1) If the RichEdit control is created with ($WS_HSCROLL, $ES_AUTOHSCROLL) styles, then you'll have a horizontal scrollbar and your file should be displayed on 1 line 2) If the RichEdit control is created without ($WS_HSCROLL, $ES_AUTOHSCROLL) styles, then you won't have a horizontal scrollbar and your file should be displayed on plenty of lines Link to comment Share on other sites More sharing options...
mike1950r Posted May 12, 2023 Author Share Posted May 12, 2023 (edited) Hi, thanks for your answer. Here is my richedit control: $hStyle = BitOR($ES_MULTILINE, $ES_WANTRETURN, $ES_NOHIDESEL, $WS_VSCROLL, $WS_HSCROLL) $hExStyle = $WS_EX_CLIENTEDGE $hGlo_WE_Control = _GUICtrlRichEdit_Create($hGlo_WE_GUI, "", 0, 0, $iWidth, $iHeight, $hStyle, $hExStyle) _GUICtrlRichEdit_SetLimitOnText($hGlo_WE_Control, 100000) If i load this file, i get one line but not the whole content length while the window is opened for the whole length, but from the middle of the window the content is not displayed until i hover over with the mouse. If i select all and copy to another program like notepad++, i can see the whole content. so the whole content is loaded into rich edit control, it is a display problem. thanks for assistance cheers mike Edited May 13, 2023 by mike1950r Link to comment Share on other sites More sharing options...
Solution pixelsearch Posted May 13, 2023 Solution Share Posted May 13, 2023 (edited) @mike1950r I did a few tests, here are the results : _GUICtrlRichEdit_SetLimitOnText isn't required if we paste directly Plain text in a RichEdit control, but it is required to bypass the 32KB/64KB limits when we paste RTF text ( e.g a long string starting with "{\rtf or "{urtf" ) . Also, the limit value we indicate is the number of characters in the string of RTF text, minus the RTF keywords lenght present in the string (more or less) In my tests, the value I indicated in _GUICtrlRichEdit_SetLimitOnText was much more than 64KB : I indicated 2.000.000 characters as a limit, then pasted an RTF string of 1.000.000 RTF text characters in the RichEdit control : all the RTF text appeared correctly (especially the very last characters) so I don't know why this 64KB limit is mentioned everywhere. Please anyone, share your knowledge about this if you got infos, thanks. Now let's talk about the string found in your file "registrymodifications.xcu", it's a string of 41KB which contains characters and spaces, but doesn't contain any line break. Let's see what happens in NotePad, WordPad, an AutoIt RichEdit control or Scite, when Wrap is not ticked1) Scite : the easiest one first. The 41KB string is displayed on 1 line (when Wrap is unticked) and fully visible from the beginning till the end, great !2) NotePad : the string is displayed on 41 lines, when Wrap is unticked (as Notepad's right limit is 1024 chars) so 1024 *41 is more or less 41KB (the file size) If Wrap is ticked, then of course much more of than 41 lines are displayed (wrapping occurs if a space is found between words, or if a 'line' covers the whole width of the Notepad window, without any space in it, then it wraps inside a word as no space has been found). So we can say all text is always visible in NotePad, as you indicated in your post.3) WordPad : now the issues start when Wrap is unticked : - If a string got less than 10.772 characters (and doesn't contain any line break) then it is correctly displayed and fully visible on 1 line, there is an horizontal (scrollbar and if you press Home/End keys, the caret will be placed automatically at the beginning or the end of the string : so far so good.- If the string got exactly 10.772 characters, then the scrollbar disappears, the End key isn't functional and you see only a part of the string.- If the string got more than 10.772 characters then nothing good will happen too (you won't be able to see the end of the line, because Wrap is unticked. The horizontal scrollbar may appear or not, depending on how many characters have been added to 10.772 , a kind of cycle)4) AutoIt RichEdit control (with Wrap unticked) : It's exactly the same issues than WordPad, except the limit is 8.192 characters (instead of 10.772 for WordPad) The solution (in WordPad and RichEdit control) should be to check Wrap in this case, so all lines appear on the screen. A good thing could be to have an option, in a GUI containing a RichEdit control, to wrap/unwrap the content of the control, when user needs it.@InunoTaishouindicated in this post how to do it for a RichEdit control (wrap/unwrap, on the fly) There's also a post here where we discussed the way to do it for a regular edit control, which could be handy when needed. Hope it helps Edited May 13, 2023 by pixelsearch typo mike1950r 1 Link to comment Share on other sites More sharing options...
mike1950r Posted May 13, 2023 Author Share Posted May 13, 2023 thanks pixelsearch, your post really helped me a lot. if i use this wrap function, the file is displayed completely but devided in lines. i also checked out in wordpad, and confirm, it's like in richedit not displayed. but for me there keeps the question, if it's possible to display the content in ONE line, like the original is, like it is displayed in notepad++ or as you say in scite. if there is no chance to display it in this way, how would richedit automaticly detect, that it should switch to the wrap option. do you have an idea how this condition should be written? thanks again, you are really great. ( you cannot imagine how many hours i have been checkung around to find a solution for that.) cheers mike Link to comment Share on other sites More sharing options...
mike1950r Posted May 13, 2023 Author Share Posted May 13, 2023 Pixelsearch, I tried this modification to automate the wrap if needed: Func _GUICtrlRichEdit_WordWrapAuto($hWnd, $sText) Local $bEnable $bEnable = False If StringLen($sText) > 8192 Then If Not StringInStr($sText, @CRLF) Then $bEnable = True EndIf EndIf If (IsHWnd($hWnd) = False) Then Return SetError(1, 0, False) EndIf DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", $EM_SETTARGETDEVICE, "wparam", 0, "lparam", Not $bEnable) If (@Error) Then Return SetError(2, @extended, False) EndIf Return True EndFunc cheers and thanks again mike pixelsearch 1 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