CYCho Posted November 27 Share 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 Saturday at 08:11 PM by CYCho zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
CYCho Posted Thursday at 12:39 AM Author Share Posted Thursday at 12:39 AM (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 Sunday at 11:24 AM by CYCho zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
CYCho Posted Friday at 05:54 AM Author Share Posted Friday at 05:54 AM (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 Friday at 05:58 AM by CYCho argumentum and Musashi 1 1 zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
jchd Posted Saturday at 05:53 PM Share Posted Saturday at 05:53 PM 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) Link to comment Share on other sites More sharing options...
pixelsearch Posted Sunday at 07:08 PM Share Posted Sunday at 07:08 PM @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 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