MiniBrowser demo : Added context menu option to show the ZoomPct value in the statusbar

This commit is contained in:
Salvador Díaz Fau 2019-10-18 17:26:03 +02:00
parent 86fd4a0c4d
commit 91615ff437
2 changed files with 14 additions and 0 deletions

View File

@ -269,6 +269,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
OnNavigationVisitorResultAvailable = Chromium1NavigationVisitorResultAvailable
OnDownloadImageFinished = Chromium1DownloadImageFinished
OnCookiesFlushed = Chromium1CookiesFlushed
OnExecuteTaskOnCefThread = Chromium1ExecuteTaskOnCefThread
OnRenderCompMsg = Chromium1RenderCompMsg
OnLoadEnd = Chromium1LoadEnd
OnLoadError = Chromium1LoadError

View File

@ -82,6 +82,7 @@ const
MINIBROWSER_CONTEXTMENU_GETNAVIGATION = MENU_ID_USER_FIRST + 12;
MINIBROWSER_CONTEXTMENU_MUTEAUDIO = MENU_ID_USER_FIRST + 13;
MINIBROWSER_CONTEXTMENU_UNMUTEAUDIO = MENU_ID_USER_FIRST + 14;
MINIBROWSER_CONTEXTMENU_SHOWZOOMPCT = MENU_ID_USER_FIRST + 15;
type
TMiniBrowserFrm = class(TForm)
@ -232,6 +233,8 @@ type
pluginUrl: ustring; isMainFrame: Boolean;
const topOriginUrl: ustring; const pluginInfo: ICefWebPluginInfo;
var pluginPolicy: TCefPluginPolicy; var aResult: Boolean);
procedure Chromium1ExecuteTaskOnCefThread(Sender: TObject;
aTaskID: Cardinal);
protected
FResponse : TStringList;
@ -385,6 +388,7 @@ begin
model.AddItem(MINIBROWSER_CONTEXTMENU_JSWRITEDOC, 'Modify HTML document');
model.AddItem(MINIBROWSER_CONTEXTMENU_JSPRINTDOC, 'Print using Javascript');
model.AddItem(MINIBROWSER_CONTEXTMENU_SHOWRESPONSE, 'Show server headers');
model.AddItem(MINIBROWSER_CONTEXTMENU_SHOWZOOMPCT, 'Show ZoomPct');
if DevTools.Visible then
model.AddItem(MINIBROWSER_CONTEXTMENU_HIDEDEVTOOLS, 'Hide DevTools')
@ -564,6 +568,9 @@ begin
MINIBROWSER_CONTEXTMENU_MUTEAUDIO :
Chromium1.AudioMuted := True;
MINIBROWSER_CONTEXTMENU_SHOWZOOMPCT :
Chromium1.ExecuteTaskOnCefThread(TID_UI, 1);
end;
end;
@ -602,6 +609,12 @@ begin
end;
end;
procedure TMiniBrowserFrm.Chromium1ExecuteTaskOnCefThread(Sender: TObject;
aTaskID: Cardinal);
begin
ShowStatusText('ZoomPct : ' + floattostr(Chromium1.ZoomPct));
end;
procedure TMiniBrowserFrm.Chromium1FullScreenModeChange(Sender: TObject;
const browser: ICefBrowser; fullscreen: Boolean);
begin