Reintroduced overrides for CreateWnd because the component creation at runtime will not work without it. Refactored the initialization to not be called 2 times, one from Loaded and one from CreateWnd. Tested win32 but it should not affect other widgetsets.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1380 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
Joshy
2010-11-24 13:54:27 +00:00
parent 15fa426cc3
commit 98c77fabc7

View File

@ -183,6 +183,7 @@ type
//misc settings //misc settings
FDisableJavaScript: Boolean; FDisableJavaScript: Boolean;
FInitializationStarted: Boolean;
FInitialized: Boolean; FInitialized: Boolean;
function GetDisableJavaScript: Boolean; function GetDisableJavaScript: Boolean;
@ -208,6 +209,7 @@ type
//function GetMarkupDocumentViewer: nsIMarkupDocumentViewer; //function GetMarkupDocumentViewer: nsIMarkupDocumentViewer;
//function GetDocShell: nsIDocShell; //function GetDocShell: nsIDocShell;
//function GetDocumentCharsetInfo: nsIDocumentCharsetInfo; //function GetDocumentCharsetInfo: nsIDocumentCharsetInfo;
procedure DoInitializationIfNeeded;
protected protected
procedure Paint; override; procedure Paint; override;
public public
@ -239,6 +241,10 @@ type
procedure Resize; override; procedure Resize; override;
procedure Loaded; override; procedure Loaded; override;
//TWinControl
procedure CreateWnd; override;
procedure DestroyWnd; override;
protected protected
property Chrome: TCustomGeckoBrowserChrome property Chrome: TCustomGeckoBrowserChrome
read FChrome write SetChrome; read FChrome write SetChrome;
@ -1054,17 +1060,24 @@ end;
procedure TCustomGeckoBrowser.Loaded; procedure TCustomGeckoBrowser.Loaded;
begin begin
inherited Loaded; inherited Loaded;
if not (csDesigning in ComponentState) then DoInitializationIfNeeded;
end;
procedure TCustomGeckoBrowser.CreateWnd;
begin begin
InitWebBrowser; {$IFDEF DEBUG}
LoadURI('about:blank'); OutputDebugString('TGeckoBrowser.CreateWnd');
FInitialized:=true; {$ENDIF}
if Assigned(FOnSetupProperties) then begin inherited CreateWnd;
FOnSetupProperties(Self); DoInitializationIfNeeded;
end;
//Set again the published properties
SetDisableJavascript(FDisableJavaScript);
end; end;
procedure TCustomGeckoBrowser.DestroyWnd;
begin
{$IFDEF DEBUG}
OutputDebugString('TGeckoBrowser.DestroyWnd');
{$ENDIF}
inherited DestroyWnd;
end; end;
procedure TCustomGeckoBrowser.GoBack; procedure TCustomGeckoBrowser.GoBack;
@ -1895,6 +1908,23 @@ begin
{$ENDIF} {$ENDIF}
end; end;
procedure TCustomGeckoBrowser.DoInitializationIfNeeded;
begin
if not FInitializationStarted then
if not (csDesigning in ComponentState) then
begin
FInitializationStarted:=true;
InitWebBrowser;
LoadURI('about:blank');
FInitialized:=true;
if Assigned(FOnSetupProperties) then begin
FOnSetupProperties(Self);
end;
//Set again the published properties
SetDisableJavascript(FDisableJavaScript);
end;
end;
{ {
function TCustomGeckoBrowser.GetMarkupDocumentViewer: nsIMarkupDocumentViewer; function TCustomGeckoBrowser.GetMarkupDocumentViewer: nsIMarkupDocumentViewer;
var var