History

<< Click to Display Table of Contents >>

Navigation:  Appendix > HTTP Interface >

History

The history uses a string list and an index into this list.

 

Event for both buttons.

 

procedure TWPWebBrowser.BackBtnClick(Sender: TObject);

begin

if Sender = BackBtn then // Click on <--

   dec(historypos)

else inc(historypos); // Click on -->

 Load(history[historypos], false);

end;

 

and the method which updates the enabled state

 

procedure TWPWebBrowser.UpdateButtons;

begin

 BackBtn.Enabled := (historypos > 0) and (history.Count > 0);

 NextBtn.Enabled := (historypos < history.Count - 1);

end;

 

The Page is loaded when clicking "Refresh" or when clicking on a hyperlink or when pressing enter in the URL edit field.

 

procedure TWPWebBrowser.RefershBtnClick(Sender: TObject);

begin

 Load(URLEdit.Text, false);

end;

 

procedure TWPWebBrowser.WPRichText1HyperLinkEvent(Sender: TObject; text,

 url: string; IgnoredNumber: Integer);

begin

 inc(historypos);

 Load(url, true);

end;

 

procedure TWPWebBrowser.URLEditKeyPress(Sender: TObject; var Key: Char);

begin

if Key = #13 then

begin

   Load(URLEdit.Text, true);

   Key := #0;

end;

end;