trichview.com

trichview.support




Re: Autocompletion ?


Return to index


Author

Message

Stef Mientki

Posted: 11/19/2003 11:53:29


Sorry Sergey,


there's just one small problem,

when editing tables, it doesn't work and you get access violations.

>>

>> procedure TForm3.RichViewEdit1KeyPress(Sender: TObject; var Key: Char);

>> var rve: TCustomRichViewEdit;

>>     ItemNo, WordEnd, WordStart: Integer;

>>     s: String;

>>     {..................................}

>>     function IsDelimiter(ch: Char): Boolean;

>>     begin

>>       Result := Pos(ch, RichViewEdit1.Delimiters)<>0;

>>     end;

>>     {..................................}

>> begin

>>   if not IsDelimiter(Key) then

>>     exit;

>>   rve := RichViewEdit1.TopLevelEditor;

>>   ItemNo := rve.CurItemNo;

>>   WordEnd := rve.OffsetInCurItem;

>>   if rve.GetItemStyle(ItemNo)<0 then

>>     exit;

>>   s := rve.GetItemTextA(ItemNo);

HERE, being in a table,

not the text of the current cell is catched,

but the text above the table.

I'm not familiar with tables in RV, but probably I've to do something

extras, when I'm in a table ?


thanks

Stef Mientki


>>   WordStart := WordEnd;

>>   if WordStart<1 then

>>     exit;

>>   while (WordStart-1>0) and not IsDelimiter(s[WordStart-1]) do

>>     dec(WordStart);

>>   s := Copy(s, WordStart, WordEnd-WordStart);

>>   if s='ms$' then begin

>>     rve.SetSelectionBounds(ItemNo, WordStart, ItemNo, WordEnd);

>>     rve.InsertText('one of Bills products');

>>   end;

>> end;

>>

>>

>





Powered by ABC Amber Outlook Express Converter