manual creation of HTMLHelpDatabase, HTMLBrowserHelpViewer
lazarus / 31-LCL
----------------------------------------------------------------------
Martin V · 2010-06-02 01:52
Hello,
my application has got a main form which is created manually without
using the form designer. To get help functionality, I need to create a
tHTMLHelpDatabase and a tHTMLBrowserHelpViewer object manually. When
executing help, my program crashes. To study my problem, I modified
the examples/helphtml sample which uses these two objects via
FormDesigner: I simply created these two objects manually by extending
TForm1.FormCreate and the program crashes, too:
Original sample code, Initializing HTMLHelpDatabase1 and
HTMLBrowserHelp1 via Form designer, works fine:
Code: [Select]procedure TForm1.FormCreate(Sender: TObject);
begin
HTMLHelpDatabase1.BaseURL:='file://html';
end;
Manual initialization with assigning all designer properties manually,
crashes when executing help
Code: [Select]procedure TForm1.FormCreate(Sender: TObject);
begin
LazhelpHTML.Register; {is this necessary? AutoRegister has been set
to true via designer for both objects}
HTMLBrowserHelpViewer1 := tHTMLBrowserHelpViewer(self);
HtmlBrowserHelpViewer1.BrowserParams := '%s';
HtmlBrowserHelpViewer1.BrowserPath := '';
HTMLHelpDatabase1 := tHTMLHelpDatabase(self);
HTMLHelpDatabase1.KeywordPrefix := 'HTML/';
HTMLHelpDatabase1.BaseURL:='file://html';
end;
What do I have made wrong? Where can I see what initializations are
made when initializing the two objects via form designer?
----------------------------------------------------------------------
Martin V · 2010-06-03 04:27
Oops, I forgot .Create! This bug is nearly invisible, sorry, and the
compiler accepts it.
Code: [Select]HTMLBrowserHelpViewer1 :=
tHTMLBrowserHelpViewer.CREATE(self);