trichview.com

trichview.support




Re: Text AFTER a hyperlink?


Return to index


Author

Message

Marc

Posted: 01/30/2003 2:36:57


Hi Mark,


I had the same issue (I too am a newbie). This is how I solved it (I'm sure

Sergey will let us know if there is a better way).


1) I captured the [space] and [return] key in rve.OnKeyDown like this:


procedure TForm.rveKeyDown(Sender: TObject; var Key: Word;

  Shift: TShiftState);

Const

REMOVEHYPERLINK=1;

var

StyleNo:integer;

begin

if (key=vk_return) or (key=vk_space) then

begin

    StyleNo:=rve.getitemstyle(rve.curitemno);

    if (RvStyle1.TextStyles[StyleNo].Jump)

    then

    Begin

         if (RvStyle1.TextStyles[StyleNo].Jump) then

         rve.ApplyStyleConversion(REMOVEHYPERLINK);

    end;

end;

end;


2) And also captured [return] in OnKeyUp to remove the tag, like this:


procedure TForm.rveKeyUp(Sender: TObject; var Key: Word;

  Shift: TShiftState);

begin

if (key=vk_return) then rve.SetCurrentTag(MakeTag(''));

end;


The bit I've not included here is how I 'closed off' the hyperlink using

rve.ApplyStyleConversion(REMOVEHYPERLINK) and reverted back to the previous

style, if you're unsure how to do this let me know.


Marc



"Mark Smith" <marks@virtualmethods.com> wrote:

>

>Hi -

>

>I want to be able to 'close off' a hyperlink properly when a user adds one.

>For example in the Assorted\Hypertext\CreateHyperlink demo, if you put a

>hyperlink on the last word 'button' and press space, you continue in the

>style (and tag) of the hyperlink.

>

>You can overcome this by doing rve.AddTag('', 0, 0); rve.Format; to push

>a new tag onto the end of the newly inserted hyperlink, but what if the

user

>backspaces into the hyperlink and then presses space or any other delimiter

>character?

>

>I've tried the approach given above but I'm not getting the result I need.

>

>Regards

>Mark Smith

>Virtual Methods Ltd

>(sorry if this is a newbie question!)





Powered by ABC Amber Outlook Express Converter