trichview.com

trichview.support




Re: Deleting protected text


Return to index


Author

Message

Sergey Tkachenko

Posted: 08/19/2002 19:19:57


This is a very interesting idea.


But some notes:

1) Canvas.TextWidth returns a width in pixels.

In this example, you need to use

TextLength := Length(TextLength);


2) If you use methods working with item indices (such as

SetSelectionBounds), you need to work with RichViewEdit1.GetTopLevelEditor

instead of RichViewEdit1

(and test your code when caret is in table cell)


And of course, checks are required (is current item a text? is it protected?

etc.)




> If you want you can code the behavior wanted in the OnKeyDown, when

pressing

> BackSpace:

>

> Example:

>

> if  Key = VK_BACK  then

> begin

>     {You may use GetCurrentTextInfo or GetTextInfo}

>     RichViewEdit1.GetCurrentTextInfo(ls_Text, li_Tag);

>     li_TextLength := RichViewEdit1.Canvas.TextWidth(ls_Text);

>     RichViewEdit1.SetSelectionBounds(RichViewEdit1.CurItemNo,

li_TextLength

> , RichViewEdit1.CurItemNo, 1);

>     RichViewEdit1.DeleteSelection;

> end;

>

> Of course you can also create the behavior when pressing the Delete key.

>

>





Powered by ABC Amber Outlook Express Converter