trichview.com

trichview.support




Re: tables, select, scrollto


Return to index


Author

Message

Sergey Tkachenko

Posted: 10/29/2003 22:47:19


Hi,


I assume that you use TRichView, not TRichViewEdit. Am I right?


function FindTable(rv: TCustomRichView; ch: Char): Integer;

var i: Integer;

    s: String;

    table: TRVTableItemInfo;

begin

  for i := 0 to rv.ItemCount-1 do

    if rv.GetItemStyle(i)=rvsTable then begin

     // Checkin the first characte in the first line

     // in table.Cell[0,0]

     table := TRVTableItemInfo(rv.GetItem(i));

     if (table.Cells[0,0].GetItemStyle(0)>=0) then begin

       s := table.Cells[0,0].GetItemTextA(0);

       if (s<>'') and (s[1]=ch) then begin

         Result := i;

         exit;

       end;

     end;

  end;

  Result := -1;

end;


Using:


ItemNo := FindTable(rv, 'b');

if ItemNo>=0 then begin

   rv.GetItemCoords(ItemNo, x, y);

   rv.ScrollTo(y);

end;


>

> Hi

>

> I have created a list in tables. This is what i try to do :

> If user press "b" key, application have to scroll the table list to the

first

> table who have text starting with "b"...

>

> I don't know how to do that.. Any idea ? Thanks.





Powered by ABC Amber Outlook Express Converter