Page 1 of 1

devtool window

Posted: Tue May 20, 2025 9:38 am
by coater
FaDevTools: TCEFWindowParent;

FormCreate:------>

FaDevToolsPanel := TPanel.Create(self);
FaDevToolsPanel.Caption := '...';
FaDevToolsPanel.Parent := self;
FaDevToolsPanel.Width := 1;
FaDevToolsPanel.Align := alRight;
FaDevToolsPanel.BevelOuter := bvNone;
FaDevToolsPanel.Visible := false;
// create aDevTools
FaDevTools := TCEFWindowParent.Create(FaDevToolsPanel);
FaDevTools.Parent := FaDevToolsPanel;
FaDevTools.Width := 0;
FaDevTools.Align := alClient;
FaDevTools.Visible := false;

TempClient := TCustomClientHandler.Create(Chromium, true);

WindowInfoAsChild(awindowInfo,
FaDevtools.Handle, //
FaDevtools.ClientRect,
'DevTools', 0);
FChromium.Browser.Host.ShowDevTools(@awindowInfo, TempClient,
@asettings, TempPPoint)
With these codes I can put devtool on a panel in old CEF 109.
But using the newest 7103 I only get a popup window!
Please help me, thank you!

Re: devtool window

Posted: Tue May 20, 2025 2:43 pm
by salvadordf
Hi,

See the TMiniBrowserFrm.ShowDevToolsMsg and TMiniBrowserFrm.ShowDevTools functions in the MiniBrowser demo.

Re: devtool window

Posted: Wed May 21, 2025 11:17 am
by coater
I got it:
FChromium.ShowDevTools(TempPoint, FaDevtools) ;
{WindowInfoAsChild(awindowInfo,
FaDevtools.Handle, //
FaDevtools.ClientRect,
'DevTools', 0); }
FChromium.ShowDevTools(TempPoint, FaDevtools) ;
// FChromium.Browser.Host.ShowDevTools(@awindowInfo, TempClient,
// @asettings, TempPPoint)

Now there is another problem.
When showing devtools for the first time and not adjust the width of devtools, that won't display correctly as in the picture.

May I disable the hint of 'DevTools is now available in...'?
Thank you!

Re: devtool window

Posted: Wed May 21, 2025 1:47 pm
by salvadordf
See that the MiniBrowser demo changes some properties to show an d hide the devtools.

The TCEFWindowParent instance for the devtool is called "DevTools" in MiniBrowser and the demo changes the visibility and the width of that control in TMiniBrowserFrm.ShowDevTools

Perhaps a simple resize is needed to show the devtools correctly.

Re: devtool window

Posted: Thu May 22, 2025 10:58 am
by coater
salvadordf wrote: Wed May 21, 2025 1:47 pm See that the MiniBrowser demo changes some properties to show an d hide the devtools.

The TCEFWindowParent instance for the devtool is called "DevTools" in MiniBrowser and the demo changes the visibility and the width of that control in TMiniBrowserFrm.ShowDevTools

Perhaps a simple resize is needed to show the devtools correctly.
MiniBrowser demo also has this bug.

How to disable some default menu items ?

Re: devtool window

Posted: Sun May 25, 2025 5:06 pm
by salvadordf
Implement TChromiumCore.OnBeforeContextMenu and use this code to get a list of menu items in the log file :

Code: Select all

  i := 0;
  while (i < model.GetCount) do
    begin
      OutputDebugMessage('index: ' + inttostr(i) + ' label: ' + quotedstr(model.GetLabelAt(i)) + ' commandid:' + inttostr(model.GetCommandIdAt(i)));
      inc(i);
    end;
Then check the "commandid:" values in the log with the IDC_CONTENT_CONTEXT_* constants and call ICefMenuModel.Remove in OnBeforeContextMenu like this:

Code: Select all

model.Remove(IDC_CONTENT_CONTEXT_INSPECTELEMENT);

Re: devtool window

Posted: Mon May 26, 2025 6:22 am
by coater
Thank you very much!