trichview.com

trichview.support




Re: How Can I Select Current Character


Return to index


Author

Message

Sergey Tkachenko

Posted: 04/04/2003 18:18:10


procedure SelectCurrentChar(rve: TCustomRichViewEdit);

var ItemNo, Offs: Integer;

begin

  rve := rve.TopLevelEditor;

  ItemNo := rve.CurItemNo;

  Offs := rve.OffsetInCurItem;

  if (Offs<rve.GetOffsBeforeItem(ItemNo)) and

    (ItemNo>0) and not rve.IsFromNewLine(ItemNo) then begin

    dec(ItemNo);

    Offs := rve.GetOffsAfterItem(ItemNo);

  end;

  if rve.GetItemStyle(ItemNo)>=0 then begin

    dec(Offs);

    if Offs=0 then Offs := 1;

    if rve.GetItemText(ItemNo)='' then

      exit;

    rve.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs+1);

    rve.Invalidate;

  end;

end;


This function selects character to the left of caret (or to the right, if

caret is at the beginning of paragraph).

If in empty line, it does nothing.


>

> Hi everyone. I want to select current character( not current word) what

should

> I do?

> Thank you all!





Powered by ABC Amber Outlook Express Converter