Forum > LCL
manual creation of HTMLHelpDatabase, HTMLBrowserHelpViewer
(1/1)
Martin V:
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: ---procedure TForm1.FormCreate(Sender: TObject);
begin
HTMLHelpDatabase1.BaseURL:='file://html';
end;
--- End code ---
Manual initialization with assigning all designer properties manually, crashes when executing help
--- Code: ---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;
--- End code ---
What do I have made wrong? Where can I see what initializations are made when initializing the two objects via form designer?
Martin V:
%) Oops, I forgot .Create! This bug is nearly invisible, sorry, and the compiler accepts it.
--- Code: ---HTMLBrowserHelpViewer1 := tHTMLBrowserHelpViewer.CREATE(self);
--- End code ---
Navigation
[0] Message Index