|
-
May 27th, 2010, 09:57 PM
#1
Keyword Highlighting Issue
Hello,
I have been working on a project which requires certain keywords such as added names and other keyword to be changed to a different color when typing in a rich edit. Currently, I am using EM_SETCHARFORMAT, however, this isn't what I presume to be the best solution to this issue. EM_SETCHARFORMAT requires that you set the highlighting and because of that it causes a lot of jumping in the control. I was wondering is there another message I could send that would be better? Or would I have to subclass it, and if that is the case, how would I go about doing something like that?
Thank You.
-
May 27th, 2010, 10:15 PM
#2
Re: Keyword Highlighting Issue
Just to clarify by better, I mean something that does not require me to select the text I would like to format.
-
May 28th, 2010, 07:25 AM
#3
Re: Keyword Highlighting Issue
To avoid all the jumping in the control, set the redraw to false, do the formatting, then set redraw to true.
http://msdn.microsoft.com/en-us/libr...8VS.80%29.aspx
-
May 28th, 2010, 04:54 PM
#4
Re: Keyword Highlighting Issue
Thank You very much for your reply. I tried what you suggested and it did help. But not exactly what I was looking for, because WM_SETREDRAW adds lag in typing now.
-
May 28th, 2010, 07:34 PM
#5
Re: Keyword Highlighting Issue
The trick is to just do one line at a time. Write two functions; one for a single line, and one for the whole control (or just the visible window). Handle the EN_CHANGE notification and only format one line unless the change is a carriage return or you have multi-line formating to deal with (like C's /* ... */ ).
-
June 4th, 2010, 04:23 PM
#6
Re: Keyword Highlighting Issue
I don't have to deal with multiple line keywords. About obtaining the single, I am able to obtain the text, however I would also like to know the offset from the entire text to that line. I am not exactly sure how to do that, I have looked through the MSDN references but haven't found anything of much use. Any help is appreciated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|