Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

devtool window

Post Reply
coater
Posts: 210
Joined: Sat Sep 29, 2018 1:51 pm

devtool window

Post 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!
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: devtool window

Post by salvadordf »

Hi,

See the TMiniBrowserFrm.ShowDevToolsMsg and TMiniBrowserFrm.ShowDevTools functions in the MiniBrowser demo.
coater
Posts: 210
Joined: Sat Sep 29, 2018 1:51 pm

Re: devtool window

Post 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!
You do not have the required permissions to view the files attached to this post.
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: devtool window

Post 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.
coater
Posts: 210
Joined: Sat Sep 29, 2018 1:51 pm

Re: devtool window

Post 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 ?
You do not have the required permissions to view the files attached to this post.
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: devtool window

Post 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);
coater
Posts: 210
Joined: Sat Sep 29, 2018 1:51 pm

Re: devtool window

Post by coater »

Thank you very much!
Post Reply