trichview.com

trichview.support




Re: iterating through hyperlinks in tables


Return to index


Author

Message

Sergey Tkachenko

Posted: 01/28/2005 21:58:52


id := -1;

  LockWindowUpdate(rvForm.Handle);

  repeat

    inc(id);

    rvForm.GetJumpPointLocation(id, RVFData, ItemNo);

    if ItemNo > 0 then begin

      strKeyID := PChar(RVFData.GetItemTag(ItemNo));

      IDPos := pos('~K/', strKeyID);

      if IDPos > 0 then begin

        strKeyID := copy(strKeyID, IDPos + 3, length(strKeyID));

        if strKeyID = KeyIDToMatch then

        begin

         // mark Key hyperlink as selected

          RVData := RVData.Edit;

          TCustomRVFormattedData(RVData).SetSelectionBounds(

            ItemNo, RVData.GetOffsBeforeItem(ItemNo),

            ItemNo, RVData.GetOffsAfterItem(ItemNo));

          MarkHyperlinkAsSelected(ItemNo);

      end;

    end;

  until ItemNo = -1;

  LockWindowUpdate(0);





>

> Hello,

>

> In addition to my last post, I am having the same issue with hyperlinks in

> table cells. Here is my code:

>

> procedure TfmRecordBreaker.MarkHyperlinkAsSelected(ItemNo : integer);

> begin

>   with rvForm do begin

>     SetSelectionBounds(ItemNo, 0, ItemNo, length(GetItemTextA(ItemNo)) +

> 1);

>     ReadOnly := False;

>     ApplyStyleConversion(scUsedHyperlinkOn);

>     ReadOnly := True;

>     Deselect;

>   end;

> end;

>

>   id := -1;

>   LockWindowUpdate(rvForm.Handle);

>   repeat

>     inc(id);

>     rvForm.GetJumpPointLocation(id, RVFData, ItemNo);

>     if ItemNo > 0 then begin

>       strKeyID := PChar(RVFData.GetItemTag(ItemNo));

>       IDPos := pos('~K/', strKeyID);

>       if IDPos > 0 then begin

>         strKeyID := copy(strKeyID, IDPos + 3, length(strKeyID));

>         if strKeyID = KeyIDToMatch then

>          // mark Key hyperlink as selected

>           MarkHyperlinkAsSelected(ItemNo);

>       end;

>     end;

>   until ItemNo = -1;

>   LockWindowUpdate(0);

>

> If one hyperlink is in a table cell and another is not, my code is not

going

> to find the one in the table cell because the ItemNo returned is relative

> to the editor. Therefore, if a hyperlink in a table cell returns ItemNo=1,

> my code is going to change the font for ItemNo 1 in the main document,

which

> is the wrong item (right ItemNo, wrong editor).

>

> How can I locate the correct InPlaceEditor (particularly when there could

> be many tables) in order to get the correct item in that editor?

>

> Thanks.





Powered by ABC Amber Outlook Express Converter