NMS Posted 6 hours ago Posted 6 hours ago Hello. I'm currently trying to create some sort of a separator line in the rich edit. My control can be resized so the line needs to adjust accordingly to new width. Preferably the line needs to be 1 pixel in height. Couple of things I've tried but failed are: 1. Using RTF (example below). 2. Filling the line with spaces to then use _GUICtrlRichEdit_SetCharBkColor. However this doesn't work as the line wraps around and I also can't decrease the line height to match the desired 1px height. I was thinking of using RTF and somehow removing the wrapping of that particular line to add _StringRepeat('—', 100) but I couldn't make it work. The one thing that I will not do is subclassing and checking for width change of the control to then look for that specific line and replace let's say 10 "—" with 12 "—" because the control in question can have thousands of lines. Any help is appreciated. #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <WindowsStylesConstants.au3> Example() Func Example() Local $hGui, $hRichEdit, $iMsg $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220, _ BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) GUISetState(@SW_SHOW) _GUICtrlRichEdit_AppendText($hRichEdit, 'Test 1' & @CRLF) _GUICtrlRichEdit_AppendText($hRichEdit, '{\rtf1{\pard \brdrb \brdrs \brdrw10 \brsp20 \par}{\pard\par}}') ;Doesn't display anything _GUICtrlRichEdit_AppendText($hRichEdit, 'Test 2' & @CRLF) _GUICtrlRichEdit_AppendText($hRichEdit, '{\rtf1{\trowd\trgaph0\cellx12000{\pard\intbl\brdrb\brdrs\brdrw10\cell}\row}\pard\par}') ;Can't remove left, right and top/bottom border _GUICtrlRichEdit_AppendText($hRichEdit, 'Test 3' & @CRLF) _GUICtrlRichEdit_AppendText($hRichEdit, '—————————————————————————————————————————————————————————————————') ;Wraps around While True $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes GUIDelete($hGui) Exit EndSelect WEnd EndFunc ;==>Example
jchd Posted 6 hours ago Posted 6 hours ago Try using Word, LibreOffice or equivalent to create a document containing "some text" <style Horizontal line> "some text and save as .RTF. This should give you an idea on how this translates into RTF. 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)
NMS Posted 3 hours ago Author Posted 3 hours ago I don't think I know how Word works nowadays because from the following document that looks like: Spoiler I received an .rtf file with 44100 characters (opened in Notepad++) where not a single instance of the word "test" was found. However, I was able to somewhat pinpoint this line and it looks something like: "\pard\plain \ltrpar\ql \li0\ri0\sa160\sl259\slmult1\widctlpar\brdrb\brdrs\brdrw15\brsp20 \wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 " which did nothing in rich edit control. Maybe my settings for Word are wrong but I have no clue as I haven't touched it in over 10 years. Tried using some online tools with similar results. Anyway, after some playing with this, I was able to create a line by making a box and shrinking it to a height of 1 pixel. However now I'm stuck with trying to color it. No matter what, it doesn't seem to work. Suggestions are welcome! Here's the current result: _GUICtrlRichEdit_AppendText($hRichEdit, '{\rtf1{\trowd\trgaph0\trrh-15' & _ '\clbrdrt\brdrnil' & _ '\clbrdrl\brdrnil' & _ '\clbrdrb\brdrs\brdrw10\brdrcf1' & _ '\clbrdrr\brdrnil' & _ '\cellx20000\pard\intbl ' & _ '\cell\row}}')
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