trichview.com

trichview.support




Re: Hyperlinks again


Return to index


Author

Message

Sergey Tkachenko

Posted: 08/16/2002 1:22:53


Tags cannot be applied to the part of text item.

You need to make the selected part of text a separate item.

It can be done by applying some different text style to the selection (I

hope, hyperlinks have a special text style in your program) - call

ApplyTextStyle before the cycle SetItemTag.


Note 1:


It's better to use the following function for obtaining stno and enno:


procedure GetSelectionBounds(rve: TCustomRichViewEdit;

  var StartNo, EndNo: Integer);

var StartOffs, EndOffs: Integer;

begin

   rve.RVData.GetSelectionBoundsEx(StartNo, StartOffs, EndNo, EndOffs,

True);

   if (StartNo<>EndNo) or (StartOffs<>EndOffs) then begin

     if StartOffs>=rve.GetOffsAfterItem(StartNo) then

       inc(StartNo);

     if EndOffs<=rve.GetOffsBeforeItem(EndNo) then

       dec(EndNo);

   end;

end;


Note 2: It's better to use SetItemTagEd, and undo grouping.


> Well, as I made myself clear, I do not have TrvActionInsertHyperlink,

since

> an executable file cannot help me very much. That's  why I am asking. My

> question is how can I iterate through the following items :

> 1

> 2

> 3

> 7 8 9

> 4

> 5

> 6

> If I select the '9' and use GetSelectionBounds, I receive values like

> StartNum 3

> EndNum 3

> StartOffest 5

> EndOffest 6

> CurItemNo 3

>

> So, if I simply use RVE.SetItemTag, it wont work ( a simple example is if

I

> apply a hyperlink on multiple lines). So I use the following :

>                 for i:=stno to enno do

>                   begin

>                     RVE.SetItemTag(i,Integer(StrNew(PChar(URL))));

>                   end;

> (stno and enno are the numbers, obrained from

>             RVE.GetSelectionBounds(stno,stof,enno,enof,true);

> )

> However, this doen't work because it applies the tag over the whole row.

So

> there must be someting else, some way to iterate through items. And the

> question is : How? :))

>

> --Slavi

>

> "Sergey Tkachenko" <[email protected]> wrote in message

> news:[email protected]...

> > Sorry, I missed you question.

> > But I do not understand.

> > What do you want to implement? Convert selected text to the hypertext?

> > If yes, you need

> > 1) apply hypertext style (using ApplyTextStyle or ApplyStyleConversion)

> > 2) enumerate all selected items and change their tags to hypertext

target.

> >

> > RichViewActions have TrvActionInsertHyperlink action that does this

work.

> >

> > > Has anyone seen that?

> > >

> > > "Slavi Marinov" <[email protected]> wrote in message

> > > news:[email protected]...

> > > > What if I want to insert a hyperlink on text on multiple lines,

which

> is

> > > > placed in a table? Then GetSelectionBound returns for example 0 for

> both

> > > > StartItem and EndItem, but some values for the offests. How should I

> use

> > > > them?

> > > >

> > > >

> > > > Slavi

> > > >

> > > >

> > >

> > >

> >

> >

>

>





Powered by ABC Amber Outlook Express Converter