Removing Hyperlinks

General TRichView support forum. Please post your questions here
Post Reply
mposthuma
Posts: 8
Joined: Wed Nov 23, 2005 7:29 pm
Location: The Netherlands

Removing Hyperlinks

Post by mposthuma »

Hi Sergey

How do I delete Hyperlinks?

Thanks
Michael
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do you mean converting them to plain text?
How did you add them?
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

If you use RichViewActions, the insert hyperlink action can do it. Just clear link target in the dialog.
mposthuma
Posts: 8
Joined: Wed Nov 23, 2005 7:29 pm
Location: The Netherlands

Post by mposthuma »

Hi Sergey

All I want is for the user to highlight text that contains Hyperlinks and then press a button that removes any hyperlinks linked in the selected text.

What would the code behind that button be?

CHeers,
Michael
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

If you use RichViewActions:

Create a new TrvActionInsertHyperlink action.
In the localization procedure of your form, assign its caption and hint to something like 'Convert To Plain Text', 'Remove Hyperlinks'.

Implement 2 events of this action: OnHyperlinkForm and OnUpdate.
In the ActionTest demo, they will be:

Code: Select all

procedure TrvActionsResource.rvActionInsertHyperlink2HyperlinkForm(
  Sender: TObject; InsertNew: Boolean; var Text, Target: String;
  var Proceed: Boolean);
begin
  if not InsertNew then begin
    Text := '';
    Target := '';
    Proceed := True;
    end
  else
    Proceed := False;
end;

procedure TrvActionsResource.rvActionInsertHyperlink2Update(
  Sender: TObject);
begin
  (Sender as TrvActionInsertHyperlink).Enabled := Form3.RichViewEdit1.SelectionExists;
end;
Post Reply