@@ -277,6 +297,14 @@ Methods
|
+procedure SetAllowWebView(aAllow : boolean); |
+
+
+ This item has no description. |
+
+
+
+
+ |
+FAllowWebView: boolean; |
+
+
+ This item has no description. |
+
Methods
@@ -382,6 +406,14 @@ Methods
|
+function GetAllowWebView: boolean; |
+
+
+ This item has no description. |
+
+
+
+ |
procedure SetOnWebUIEvent(const aEvent : TOnWebUIEvent); |
@@ -390,6 +422,14 @@ Methods
|
+procedure SetAllowWebView(aAllow : boolean); |
+
+
+ This item has no description. |
+
+
+
+ |
function Lock: boolean; |
@@ -1231,6 +1271,16 @@ Properties
|
+property AllowWebView : boolean read GetAllowWebView write SetAllowWebView; |
+
+
+
+ Allow using WebView to show a browser with TWebUIWindow.Show.
+ |
+
+
+
+ |
property OnWebUIEvent : TOnWebUIEvent read GetOnWebUIEvent write SetOnWebUIEvent; |
diff --git a/source/uWebUITypes.pas b/source/uWebUITypes.pas
index 71d4bd9..e876dd0 100644
--- a/source/uWebUITypes.pas
+++ b/source/uWebUITypes.pas
@@ -448,7 +448,11 @@ TWebUIEvent = record
function GetParentProcessID : NativeUInt;
function GetChildProcessID : NativeUInt;
function GetOnWebUIEvent : TOnWebUIEvent;
+ function GetAllowWebView : boolean;
+
procedure SetOnWebUIEvent(const aEvent : TOnWebUIEvent);
+ procedure SetAllowWebView(aAllow : boolean);
+
procedure doOnWebUIEvent(const aEvent: IWebUIEventHandler);
///
@@ -739,6 +743,10 @@ TWebUIEvent = record
///
property ChildProcessID : NativeUInt read GetChildProcessID;
///
+ /// Allow using WebView to show a browser with TWebUIWindow.Show.
+ ///
+ property AllowWebView : boolean read GetAllowWebView write SetAllowWebView;
+ ///
/// Event triggered on a browser event. It's necessay to bind the event using the TWebUIWindow.Bind* functions without a "func_" parameter.
///
property OnWebUIEvent : TOnWebUIEvent read GetOnWebUIEvent write SetOnWebUIEvent;
diff --git a/source/uWebUIWindow.pas b/source/uWebUIWindow.pas
index 7f8468b..afd4fe7 100644
--- a/source/uWebUIWindow.pas
+++ b/source/uWebUIWindow.pas
@@ -34,6 +34,7 @@ TWebUIWindow = class(TInterfacedObject, IWebUIWindow)
FOnWebUIEvent : TOnWebUIEvent;
FBindIDList : TList;
FCritSect : TCriticalSection;
+ FAllowWebView : boolean;
function GetID : TWebUIWindowID;
function GetInitialized : boolean;
@@ -43,8 +44,10 @@ TWebUIWindow = class(TInterfacedObject, IWebUIWindow)
function GetChildProcessID : NativeUInt;
function GetOnWebUIEvent : TOnWebUIEvent;
function GetBestBrowser : TWebUIBrowser;
+ function GetAllowWebView : boolean;
procedure SetOnWebUIEvent(const aEvent : TOnWebUIEvent);
+ procedure SetAllowWebView(aAllow : boolean);
function Lock : boolean;
procedure UnLock;
@@ -389,6 +392,10 @@ TWebUIWindow = class(TInterfacedObject, IWebUIWindow)
///
property BestBrowser : TWebUIBrowser read GetBestBrowser;
///
+ /// Allow using WebView to show a browser with TWebUIWindow.Show.
+ ///
+ property AllowWebView : boolean read GetAllowWebView write SetAllowWebView;
+ ///
/// Event triggered on a browser event. It's necessay to bind the event using the TWebUIWindow.Bind* functions without a "func_" parameter.
///
property OnWebUIEvent : TOnWebUIEvent read GetOnWebUIEvent write SetOnWebUIEvent;
@@ -406,6 +413,7 @@ constructor TWebUIWindow.Create;
FOnWebUIEvent := nil;
FCritSect := nil;
FBindIDList := nil;
+ FAllowWebView := {$IFDEF MSWINDOWS}True{$ELSE}False{$ENDIF};
if (WebUI <> nil) and WebUI.Initialized then
FID := webui_new_window()
@@ -583,11 +591,21 @@ function TWebUIWindow.GetBestBrowser : TWebUIBrowser;
Result := NoBrowser;
end;
+function TWebUIWindow.GetAllowWebView : boolean;
+begin
+ Result := FAllowWebView;
+end;
+
procedure TWebUIWindow.SetOnWebUIEvent(const aEvent : TOnWebUIEvent);
begin
FOnWebUIEvent := aEvent;
end;
+procedure TWebUIWindow.SetAllowWebView(aAllow : boolean);
+begin
+ FAllowWebView := aAllow;
+end;
+
procedure TWebUIWindow.SetEventBlocking(status: boolean);
begin
if Initialized then
@@ -675,7 +693,8 @@ function TWebUIWindow.BindAllEvents(func_: TWebUIBindCallback): TWebUIBindID;
function TWebUIWindow.Show(const content : string) : boolean;
var
- LContent: AnsiString;
+ LContent : AnsiString;
+ LContentPtr : PWebUIChar;
begin
Result := False;
@@ -683,11 +702,16 @@ function TWebUIWindow.Show(const content : string) : boolean;
begin
if (length(content) > 0) then
begin
- LContent := UTF8Encode(content + #0);
- Result := webui_show(FID, @LContent[1]);
+ LContent := UTF8Encode(content + #0);
+ LContentPtr := @LContent[1];
end
else
- Result := webui_show(FID, nil);
+ LContentPtr := nil;
+
+ if FAllowWebView then
+ Result := webui_show(FID, LContentPtr)
+ else
+ Result := webui_show_browser(FID, LContentPtr, AnyBrowser);
end;
end;
| | | |