Vorige en volgende button:
Code:
{
When hosting the TWebbrowser control, it may be desirable to implement
Forward/Back/Cancel buttons similar to those that Internet Explorer implements.
The WebBrowser control supports a CommandStateChange() event,
which is fired whenever the Forward/Back/Cancel button need to be enabled or disabled.
The CommandStateChange event is sent with two parameters: a constant indicating
the type of button (CSC_NAVIGATEFORWARD or CSC_NAVIGATEBACK or CSC_UPDATECOMMANDS),
and a Boolean flag indicating whether to enable or disable the button.
}
// Navigate to a URL
procedure TForm1.Button1Click(Sender: TObject);
begin
Webbrowser1.Navigate('www.SwissDelphiCenter.com');
end;
// Catch the events and set a button's Enabled state
procedure TForm1.WebBrowser1CommandStateChange(Sender: TObject;
Command: Integer; Enable: WordBool);
begin
case Command of
CSC_NAVIGATEBACK: ButtonBack.Enabled := Enable;
CSC_NAVIGATEFORWARD: ButtonForward.Enabled := Enable;
CSC_UPDATECOMMANDS: ButtonCancel.Enabled := Enable;
end;
end;
procedure TForm1.ButtonBackClick(Sender: TObject);
begin
WebBrowser1.GoBack
end;
procedure TForm1.ButtonForwardClick(Sender: TObject);
begin
WebBrowser1.GoForward
end;
procedure TForm1.ButtonCancelClick(Sender: TObject);
begin
WebBrowser1.Stop;
end;
Geleend vanaf 'www.SwissDelphiCenter.com'.
Bookmarks