I'm trying to disable the right mouse button (the context menu) in the window of Chromium Embedded (DCEF3) but I'm not getting, I did not find any settings to do this natively.
I can for example disable the "View Source", I am using the code below, but I really want is to disable the context menu, or do not want it to appear.
Note: I'm using this in DLL "Chromium.dll" a libray to be used with the "Inno Setup", equal to Inno Web Brower.
procedure TInnoChromium.OnContextMenuCommand(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame;
const params: ICefContextMenuParams; commandId: Integer;
eventFlags: TCefEventFlags; out Result: Boolean);
begin
if (commandId = 132) then Result := True; // MENU_ID_VIEW_SOURCE
end;
Note: in the C++ version:
To disable the context menu in DCEF 3 you'll need to handle the
OnBeforeContextMenu
event and clear itsmodel
parameter. That's what the reference states (emphasized by me):So, to completely disable the context menu you will write something like this: