WPCubed Product Support

How do I change background color at the end of a document?

I have implemented a highlighter pen (as in MS Word). When the pen is active, I set the highlight color to for instance clYellow, and when the mouse is released, the background of the selected text is set to yellow.

A slight problem: When text is selected till the end of the document, new text which is added at the end appears with the yellow background.
Here is a code snippet from the OnMouseUp event, which does not work in this respect:

Editor.SelectedTextAttr.SetBGColor(Editor.HighlightColor);
Editor.CPPosition := Editor.SelStart + Editor.SelLength;
Editor.SelLength := 0;
Editor.CurrAttr.BKColor := Editor.PaperColor;

How can I remove the yellow background for new text?

#1 ♥ 0
2.8k Views 2 users read 1 min
support

Since your highlighting uses stanmdard charcter attributes, here background color, that attribute will be uses wheh the cursor is placed near the text.

Editor.WritingTextAttr.SetBGColor( clNone );

should remove it from current mode

#2 ♥ 0
This category is archived. No new posts are possible.