qwert Posted March 18, 2021 Share Posted March 18, 2021 (edited) According to MSFT, it's possible to use a SetDefaultCharFormat function to set the default color for a RichEdit control: Quote You can also get and set the "default character formatting," which is the formatting applied to any subsequently inserted characters. For example, if an application sets the default character formatting to bold and the user then types a character, that character is bold. To get and set default character formatting, use the GetDefaultCharFormat and SetDefaultCharFormat member functions. link to MSFT docs But Au3 doesn't include these among the many RichEdit functions that it does. What is the proper way to set the default text color for all text entered into a RichEdit control? Thanks in advance for any help. Edited March 19, 2021 by qwert Link to comment Share on other sites More sharing options...
TheXman Posted March 19, 2021 Share Posted March 19, 2021 Isn't that what _GUICtrlRichEdit_SetCharColor() does? CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
qwert Posted March 19, 2021 Author Share Posted March 19, 2021 28 minutes ago, TheXman said: Isn't that what _GUICtrlRichEdit_SetCharColor() does? I thought so. But what I'm experiencing is that, very occasionally, text that's displayed in a control is changing to transparent text on a white background. It seems to be related to deleting some text at the end of the control ... or inserting text somewhere other than at the end. The text is there (you can view it with a Select All). So what I'd like to do is to force the control's default color to black. Supposedly, setting the default color keeps "transparent" from ever taking effect. Thanks for your response. Link to comment Share on other sites More sharing options...
Nine Posted March 19, 2021 Share Posted March 19, 2021 Make a replicable snippet of the issue, so we can test it on our side. “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...
qwert Posted March 19, 2021 Author Share Posted March 19, 2021 Yes, normally I would attempt to build an example script. But the case I'm encountering is so subtle that I haven't been able to isolate anything with a test script. It only occurs in my runtimes and only after dozens of uses (1 out of 50 edits?). But I think I'm on the tail of something. It seems centered around sending a message to the rich edit control with the EM_SETCHARFORMAT parameter. I found this reference on these forums: forum post (see the _SetColor() function) And here's another level of detail from MSFT: MSFT link Unfortunately, I've never modified a rich edit control in this way, so the going is slow. Thanks for responding. Link to comment Share on other sites More sharing options...
qwert Posted March 23, 2021 Author Share Posted March 23, 2021 After much testing, it seems that adding $WS_EX_TRANSPARENT to the RichEdit Create avoids the problem that I was trying to resolve on this thread (white text displayed on a white background following certain edit actions). Unless another problem shows up, I'll sideline any further investigation ... although, ultimately, I'd like to know how to set the low-level defaults for a Rich Edit Control. I've concluded that EM_SETCHARFORMAT and EM_SETCHARFORMAT2 bring a lot to the table ... but the associated data structures and the send message calls aren't easy, at least not that I could see. Thanks for the interest shown. 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