Hi
Is it possble to load a html page with buttons and re-act when the buttons are clicked.
Thanks
Mike
HTML Buttons
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Include rvoTagsArePChars in TRichView.Options. By default, HtmlImporter writes hyperlink targets in item tags.
A complete code working with hyperlinks in tags includes processing of 3 events: OnJump, OnReadHyperlink, OnWriteHyperlink. Just copy this code in your application:
---
Update 2011-Oct-22: for TRichView 13.3+, the code must be:
And rvoTagsArePChars is not used any more.
A complete code working with hyperlinks in tags includes processing of 3 events: OnJump, OnReadHyperlink, OnWriteHyperlink. Just copy this code in your application:
Code: Select all
uses CRVData, CRVFData, ShellApi;
procedure TForm3.RichViewEdit1Jump(Sender: TObject; id: Integer);
var ItemNo: Integer;
RVData: TCustomRVFormattedData;
s: String;
begin
RichViewEdit1.GetJumpPointLocation(id, RVData, ItemNo);
s := PChar(RVData.GetItemTag(ItemNo));
ShellExecute(0, 'open', PChar(s), nil, nil, SW_SHOW);
end;
procedure TForm3.RichViewEdit1ReadHyperlink(Sender: TCustomRichView;
const Target, Extras: String; DocFormat: TRVLoadFormat; var StyleNo,
ItemTag: Integer; var ItemName: String);
begin
ItemTag := Integer(StrNew(PChar(Target)));
end;
procedure TForm3.RichViewEdit1WriteHyperlink(Sender: TCustomRichView;
id: Integer; RVData: TCustomRVData; ItemNo: Integer;
SaveFormat: TRVSaveFormat; var Target, Extras: String);
begin
Target := PChar(RVData.GetItemTag(ItemNo));
end;
Update 2011-Oct-22: for TRichView 13.3+, the code must be:
Code: Select all
uses CRVData, CRVFData, ShellApi;
procedure TForm3.RichViewEdit1Jump(Sender: TObject; id: Integer);
var ItemNo: Integer;
RVData: TCustomRVFormattedData;
s: String;
begin
RichViewEdit1.GetJumpPointLocation(id, RVData, ItemNo);
s := RVData.GetItemTag(ItemNo);
ShellExecute(0, 'open', PChar(s), nil, nil, SW_SHOW);
end;
procedure TForm3.RichViewEdit1ReadHyperlink(Sender: TCustomRichView;
const Target, Extras: String; DocFormat: TRVLoadFormat; var StyleNo: Integer;
var ItemTag: TRVTag; var ItemName: String);
begin
ItemTag := Target;
end;
procedure TForm3.RichViewEdit1WriteHyperlink(Sender: TCustomRichView;
id: Integer; RVData: TCustomRVData; ItemNo: Integer;
SaveFormat: TRVSaveFormat; var Target, Extras: String);
begin
Target := RVData.GetItemTag(ItemNo);
end;