Fandom

Delphi Programming

Rxlib

2,918pages on
this wiki
Add New Page
Talk4 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

RX Lib (or RX Library) is large library of components and functions for Delphi all versions. New home of this library is on mirror site [1] and contains a full patch by Polaris group.

There is also a project on sourceforge which contains adaptations to work with Delphi 2006. homepage - projectpage. It also contains the "Polaris" patches.

(to whoever added the first paragraph: Please see discussion page --Dummzeuch 09:39, 3 October 2006 (UTC))

Adding a link to a TRxRichEdit Edit

TRxRichEdit uses the RichEdit dll version 2 and therefore adds some functionality on top of the standard VCL TRichEdit. One of these functions is hyperlinks.

Drop a TRxLib component on a form, add an OnCreate event to the form with the following code:

procedure TForm1.FormCreate(Sender: TObject);
var
  Attribs: TRxTextAttributes;
begin
  RichEdit1.Text := 'This text has a link in it. And this is another link.';

  RichEdit1.SelStart := 16;
  RichEdit1.SelLength := 4;
  Attribs := RichEdit1.WordAttributes;
  Attribs.Link := True;
  Attribs.Color := clBlue;

  RichEdit1.SelStart := 40;
  RichEdit1.SelLength := 12;
  Attribs := RichEdit1.WordAttributes;
  Attribs.Link := True;
  Attribs.Color := clBlue;

  RichEdit1.SelStart := 0;
  RichEdit1.SelLength := 0;
end;

Add a URLClick event handler to the TRxRichEdit and implement it like this:

procedure TForm3.RxRichEdit1URLClick(Sender: TObject; const URLText: string; Button: TMouseButton);
begin
  MessageDlg('You clicked on "' + URLText + '"', mtWarning, [mbOK], 0);
end;

Now compile and run your program. You get a form containing the text with two links.

TRxRichText with Hyperlink

If you click on any of the links, you get a message telling you which link you clicked on.

TRxRichText with Hyperlink Message

Note: The TJvRichText control from the Jedi VCL also has this function since it is originally based on TRxRichEdit.

Also on Fandom

Random Wiki