trichview.com

trichview.support




Re: Inserting a link


Return to index


Author

Message

Sergey Tkachenko

Posted: 08/28/2003 18:46:33


You are right.

Of course, the 5-th text style (RVStyle.TextStyles[5]) must be hypertext

(must have Jump property = True)


More sophisticated example: inserted text has all properties of the current

text, but blue, underlined and hypertext.


procedure TMainForm.DevButtonClick(Sender: TObject);

var

  MyNewTextStyle: integer;

  fs: TFontInfo;

begin

  fs := TFontInfo.Create(nil);

  fs.Assign(RVStyle1.TextStyles[RichViewEdit1.CurTextStyleNo]);

  fs.Color := clBlue;

  fs.Style := fs.Style + [fsUnderline];

  fs.Jump := True;

  MyNewTextStyle := RVStyle1.TextStyles.FindSuchStyle(fs,

RVAllFontInfoProperties);

  if MyNewTextStyle<0 then begin

    RVStyle1.TextStyles.Add;

    MyNewTextStyle := RVStyle1.TextStyles.Count-1;

    RVStyle1.TextStyles[MyNewTextStyle].Assign(fs);

    RVStyle1.TextStyles[MyNewTextStyle].Standard := False;

  end;

  fs.Free;

  RichViewEdit1.ApplyTextStyle(MyNewTextStyle);

  RichViewEdit1.InsertText('My new text style')

end;




> Just learning this package myself, but  right now I would call

> ApplyTextStyle :

>

> procedure TMainForm.DevButtonClick(Sender: TObject);

> var

>   MyNewTextStyle: integer;

> begin

>   MyNewTextStyle:= 5;

>   RichViewEdit1.ApplyTextStyle(MyNewTextStyle);

>   RichViewEdit1.InsertText('My new text style')

> end;






Powered by ABC Amber Outlook Express Converter