Form Setup

<< Click to Display Table of Contents >>

Navigation:  Appendix > HTTP Interface >

Form Setup

 

The Form is simple:

Web_1

 

Also required are 4 variables and 2 functions. Most of the code will be inserted into event handlers:

 

public

   history: TStringList;

   historypos: Integer;

   pendingload: Boolean;

  procedure Load(url: string; Update: Boolean);

  procedure UpdateButtons;

end;

 

In the Form.OnCreate event we insert

 

procedure TWPWebBrowser.FormCreate(Sender: TObject);

begin

 history := TStringList.Create;

 

 WPRichText1.AsWebpage := [wpFormatAsWebpage];

 WPRichText1.OneClickHyperlink := true;

  // No Table Resize

 WPRichText1.EditOptions := [wpActivateUndo, wpActivateUndoHotkey];

 

  // Hot Hyperlinks

 WPRichText1.HyperlinkTextAttr.HotEffect := wpeffTextColor;

 WPRichText1.HyperlinkTextAttr.HotEffectColor := clBlue;

 

// Limit the used fonts

 WPRichText1.RTFData.RTFProps.PreselectedFonts.Assign( Screen.Fonts );

 WPRichText1.RTFData.RTFProps.PreselectedFonts.Add('sans-serif=Frutiger');

end;

 

 

The property PreselectedFonts is important for the CSS reader.

It makes it possible to select one font alternative in cases multiple are offered in a comma separated list.

 

 

In the Form.OnDestroy event we insert

 

procedure TWPWebBrowser.FormDestroy(Sender: TObject);

begin

 history.Free;

end;