trichview.com

trichview.support




Re: Go to a Tag


Return to index


Author

Message

Sergey Tkachenko

Posted: 10/07/2003 20:20:18


Call


(if rvoTagsArePChars in rve.Options):

var Tag: Integer;

begin

  Tag := Integer(PChar('String-to-find'));

  GoToTag(RichViewEdit1.RVData, Tag);

end;


(if not (rvoTagsArePChars in rve.Options)):

var Tag: Integer;

begin

  Tag := 5;

  GoToTag(RichViewEdit1.RVData, Tag);

end;


uses CRVData, CRVFData, RVFuncs, RVTable;


function GoToTag(RVData: TCustomRVData; Tag: Integer): Boolean;

var i,r,c: Integer;

    table: TRVTableItemInfo;

begin

  for i := 0 to RVData.ItemCount-1 do begin

    if RV_CompareTags(RVData.GetItemTag(i), Tag,

         rvoTagsArePChars in RVData.Options) then begin

      RVData := RVData.Edit;

      TCustomRVFormattedData(RVData).SetSelectionBounds(

        i, RVData.GetOffsAfterItem(i),

        i, RVData.GetOffsAfterItem(i));

      Result := True;

      exit;

    end;

    if RVData.GetItemStyle(i)=rvsTable then begin

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

      for r := 0 to table.Rows.Count-1 do

        for c := 0 to table.Rows[r].Count-1 do

          if table.Cells[r,c]<>nil then begin

            Result := GoToTag(table.Cells[r,c].GetRVData, Tag);

            if Result then

              exit;

          end;

    end;

  end;

  Result := False;

end;




>

> Hello Sergey:

> How can programatically positioning the caret over an item with the tag

specified

> by the user ?

>

> Tanks

> Fernando Alonso





Powered by ABC Amber Outlook Express Converter