Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
EM_SETCHARFORMAT SCF_SELECTION question
#1
Hi -

In my code I'm iterating over an array of strings that I want to highlight in another application's rich text item. I'm using the standard SendMessage mechanism for EM_SETSEL followed by EM_SETCHARFORMAT.

The first item in the array is *not* highlighted. I can see the field being selected in the other application but the color does not change.

If I run the for loop twice - all the elements are highlighted; if I reverse the order in the array the item that is now first is not highlighted. So - there's nothing unusual about the text item itself - it seems to be the order and the first one fails (silently).

The handle for the control is activated right before the SendMessage commands are executed.

If I get and reset the event mask
int mask=SendMessage(hwndre,EM_GETEVENTMASK,0,0)
(do the hightlighting stuff..)
SendMessage(hwndre,EM_SETEVENTMASK,0,mask)
then everything is highlighted - although the undo buffer is corrupted (I'll look into that next).

The issue seems to happen with some documents and not others. I don't see a pattern.

Is there some state I should clear before running my first EM_SETSEL/EM_SETCHARFORMAT SCF_SELECTION?

Thanks.


Forum Jump:


Users browsing this thread: 1 Guest(s)