CYCho Posted November 27 Posted November 27 (edited) I found this haphazardly and used it to my benefit. But I'd like to know why and how it works. ❚ (ChrW(0x0275A)) alone had similar effect, but ▶/❚❚ combination was most suitable for my purpose. #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.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)) _GUICtrlRichEdit_SetFont($hRichEdit, 11, "Arial") _GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & "1. This is text" & @CRLF & "2. ▶/❚❚ This is more text") GUISetState(@SW_SHOW) While True $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes ; GUIDelete() ; is OK too Exit EndSelect WEnd EndFunc ;==>Example Edited November 30 by CYCho zPlayer - A Small Audio and Video Player
CYCho Posted November 28 Author Posted November 28 (edited) I made this code in order to see the difference between the bold text and the effect created by some unicode characters in the RichEdit control. I can take benefit of this unicode phenomenon, but the problem is that I cannot cancel the effect until the end of the text. expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.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)) _GUICtrlRichEdit_SetFont($hRichEdit, 12, "Arial") Local $sText1 = "2. This is bold text" Local $sText2 = "1. This is plain text" & @LF & $sText1 & @LF & "▶/❚❚" & @LF & "3. This is more plain text" _GUICtrlRichEdit_AppendText($hRichEdit, $sText2) ; Hide "▶/❚❚" in the production ;~ Local $iBegin = StringInStr($sText2, "▶/❚❚") - 1 ;~ Local $iEnd = $iBegin + 4 ;~ _GUICtrlRichEdit_SetSel($hRichEdit, $iBegin, $iEnd, True) ;~ _GUICtrlRichEdit_SetCharColor($hRichEdit, 0xFFFFFF) ;~ _GUICtrlRichEdit_ChangeFontSize($hRichEdit, -12) ; Set 2nd line to bold typeface $iBegin = StringInStr($sText2, $sText1) - 1 $iEnd = $iBegin + StringLen($sText1) _GUICtrlRichEdit_SetSel($hRichEdit, $iBegin, $iEnd, True) _GUICtrlRichEdit_SetCharAttributes($hRichEdit, "+bo") GUISetState(@SW_SHOW) While True $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes ; GUIDelete() ; is OK too Exit EndSelect WEnd EndFunc ;==>Example Edited December 1 by CYCho zPlayer - A Small Audio and Video Player
CYCho Posted November 29 Author Posted November 29 (edited) I found that the effect of ▶/❚❚ varies depending on the OS character sets. It was very much noticeable in my computer which has Hangeul character set as default. So if you want to see the same effect as I see, you should use _GUICtrlRichEdit_SetFont($hRichEdit, 12, "Arial", 129) instead of _GUICtrlRichEdit_SetFont($hRichEdit, 12, "Arial") in the example above. Edited November 29 by CYCho Musashi and argumentum 1 1 zPlayer - A Small Audio and Video Player
jchd Posted November 30 Posted November 30 Unicode codepoint 0x0275A (❚ HEAVY VERTICAL BAR) has no special effect on subsequent text. In other codepages, it's difficult to determine out of the blue what the character renderer will do. CYCho 1 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)
pixelsearch Posted December 1 Posted December 1 @CYCho today I was able to test your 1st script at my brother's home (Win11 x64) Here is the display on his computer, using charset 129 : ... _GUICtrlRichEdit_SetFont($hRichEdit, 14, "Arial", 129) ; $HANGEUL_CHARSET = 129 _GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & "1. This is text" & @CRLF & "2. ▶/❚❚ This is more text") ... So the 2nd "This is more text" appears bolder compared to the 1st one (as you noticed) IIRC charset 130 (the Korean $JOHAB_CHARSET) displayed same as 129 And when no charset parameter was set, then both "This is more text" looked same. For what it's worth... CYCho 1
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