trichview.support
Re: Insert a hyperlink by pressing button |
Author |
Message |
Sergey Tkachenko |
Posted: 10/14/2004 19:56:38 New hyperlink? rve.CurTextStyleNo := HYPERLINK_STYLE_NO; rve.InsertText('Hyperlink text', Integer(StrNew('http://www.trichview.com'))); (assuming that rvoTagsArePChars is in rve.Options). If you need to apply the hyperlink to the selected text, see Demos\Delphi\Assorted\Hypertext\CreateHyperlink\ Do you want to use some predefined text style for hyperlinks, or want to use font of the current text? If the latter you can the following function in place of HYPERLINK_STYLE_NO: function GetHyperlinkStyleNo(rve: TCustomRichViewEdit); var Style: TFontInfo; begin Result := rve.CurTextStyleNo; if rve.Style.TextStyles[Result].Jump then exit; // Constructing the desired style // (hypertext, blue, underlined) Style := TFontInfo.Create(nil); Style.Assign(rve.Style.TextStyles[Result]); Style.Jump := True Style.Style := Style.Style+[fsUnderline]; Style.Color := clBlue; Style.JumpCursor := crJump; // May be such style already exists? Result := rve.Style.TextStyles.FindSuchStyle(Result,Style,RVAllFontInfoProperties); if Result=-1 then begin // Not exists, adding... rve.Style.TextStyles.Add.Assign(Style); Result := rve.Style.TextStyles.Count-1; rve.Style.TextStyles[Result].Standard := False; end; Style.Free; end; > > I'd like to insert a hyperlink in a RichViewEdit when pressing a button. I > don't want to use popup dialogs and the hyperlink is always the same... > > Thanks. > > Pieter E. > > |
Powered by ABC Amber Outlook Express Converter