TRichViewEdit - Highlighting Text

General TRichView support forum. Please post your questions here
Post Reply
Graham
Posts: 64
Joined: Sun Jan 27, 2013 7:51 pm
Location: Berkshire U.K.

TRichViewEdit - Highlighting Text

Post by Graham »

Assume I have a paragraph of text and it is a single Item. I place the caret at the start of some line, I use the down arrow key to highlight some whole lines of text.
At this point the caret is at the start of a non-highlighted line of text. All the highlighted text is in the lines above the caret.

I now change the paragraph style and text style of the highlighted block.
The highlighted block changes correctly, but the remainder of the item (from the current caret position to the end of this Item) takes on the new paragraph style.

So basically the new paragraph style is being applied up to the end of the Item and not the end of the highlighted block. The text style is applied correctly.

If I highlight the text and leave the caret at the end of the previous line then it's OK.

Can this be fixed?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

As I understand, the beginning of the selection is in the first paragraph, the end of the selection is in the second paragraph.
This selection is different comparing to the selection ending at the end of the first paragraph: it includes (an empty) beginning of the second paragraph.

In this case a paragraph style is applied to the both paragraphs. It is expected and happens in all text editors.
Graham
Posts: 64
Joined: Sun Jan 27, 2013 7:51 pm
Location: Berkshire U.K.

Post by Graham »

Not quite. Maybe I'll explain a bit better.

There is only one paragraph of text all contained in a single item.

I put the caret at position 0 on a line.

I now start to highlight some text using the Shift+Down Arrow key.

I now have a number of whole lines (as displayed visually in the RichViewEdit) highlighted.

Now I press a button in my program which changes the Font colour, the Back colour and the Background colour of the highlighted block.

The problem is that the Background colour is applied to the highlighted block AND to the rest of the un-highlighted text.

Changing the Font colour and the Back colour of the highlighted block has created a new item with its own new style, so I assume that what was the original single paragraph could now also be changed so that the highlighted block is a paragraph in its own right.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

"Background color" - do you mean paragraph background color? It is applied to the paragraph, not to text. It's not dependent on the selection - the same result will be even if there is no selection at all.
Graham
Posts: 64
Joined: Sun Jan 27, 2013 7:51 pm
Location: Berkshire U.K.

Post by Graham »

OK, I understand. I'll try and think of a way around this.
Basically I need to change the style of a highlighted block of text. So in this instance, the highlighted block of text needs to become a new paragraph so I can change the colour of the font, the BackColor and the Background.Color.


All unhighlighted text needs to remain unchanged.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Can you send me a screenshot of the result you need?
(richviewgmailcom)
Graham
Posts: 64
Joined: Sun Jan 27, 2013 7:51 pm
Location: Berkshire U.K.

Post by Graham »

Done.
Post Reply