Page 1 of 1

Removing Hyperlinks

Posted: Mon Nov 06, 2006 7:28 pm
by mposthuma
Hi Sergey

How do I delete Hyperlinks?

Thanks
Michael

Posted: Mon Nov 06, 2006 9:43 pm
by Sergey Tkachenko
Do you mean converting them to plain text?
How did you add them?

Posted: Mon Nov 06, 2006 9:48 pm
by Sergey Tkachenko
If you use RichViewActions, the insert hyperlink action can do it. Just clear link target in the dialog.

Posted: Sat Nov 18, 2006 3:46 pm
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

Posted: Sun Nov 19, 2006 6:08 pm
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;