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.

Disable Mouse / Contextmenu

Det20
Posts: 38
Joined: Fri Mar 10, 2017 3:11 pm

Disable Mouse / Contextmenu

Post by Det20 »

Is it possible to disable Contextmenu (right click) or to complete every mouse action like move, click ...?
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Disable Mouse / Contextmenu

Post by salvadordf »

According to the CefContextMenuHandler docs :
http://magpcss.org/ceforum/apidocs3/pro ... enuModel>)

You must call model.clear inside the TChromium.OnBeforeContextMenu to disable the context menu.
Det20
Posts: 38
Joined: Fri Mar 10, 2017 3:11 pm

Re: Disable Mouse / Contextmenu

Post by Det20 »

Perfect, thank you. Please let me ask 2 more questions:

- Is it possible to disable every mouse event (move, click ...)? For example, i don't want to see the timeline from youtube if i move the mouse
- Is it possble to dynamically load Chromium Engine only if i need it?
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Disable Mouse / Contextmenu

Post by salvadordf »

Det20 wrote: Fri Mar 10, 2017 8:58 pm - Is it possible to disable every mouse event (move, click ...)? For example, i don't want to see the timeline from youtube if i move the mouse
There are several tricks you can use :
  • The easiest way : Configure TChromium to be an OSR component. Check the SimpleOSRBrowser and you'll see that you have better control of mouse and keyboard events that way.
  • A transparent panel in front of TCEFWindowParent in non OSR TChromium configuration. I haven't tested this but I remember that it was one of the recommedations for TWebBrowser.
  • Low level mouse hooks https://msdn.microsoft.com/en-us/librar ... s.85).aspx
Det20 wrote: Fri Mar 10, 2017 8:58 pm - Is it possble to dynamically load Chromium Engine only if i need it?
If you mean loading the DLLs only when needed then I'm afraid the answer is no. CEF3 needs to be initialized before the app starts.
If you mean creating the TChromium component at runtime, the answer is yes. BriskBard does that for every tab.
Det20
Posts: 38
Joined: Fri Mar 10, 2017 3:11 pm

Re: Disable Mouse / Contextmenu

Post by Det20 »

Ok, Thank you, i'll check. A last question for today: If i load a page using IE ActiveX, there's no scrollbar. Using Chromium, there is a scrollbar. Is there a property to disable every scrollbar?

BTW: Many many thanks for your good work. Your package is much better and more stable then CEF3! I love it!
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Disable Mouse / Contextmenu

Post by salvadordf »

Hi :

I'm glad that you like it. :D

Take a look at the list of command line switches here :
http://peter.sh/experiments/chromium-co ... -switches/

There are several switches that could be what you're looking for :
--enable-overlay-scrollbar
--disable-overlay-scrollbar
--hide-scrollbars

You can try them individually in your DPR file like this :
GlobalCEFApp.AddCustomCommandLine('--enable-overlay-scrollbar', '0');
GlobalCEFApp.AddCustomCommandLine('--disable-overlay-scrollbar');
GlobalCEFApp.AddCustomCommandLine('--hide-scrollbars');

They must be called before the GlobalCEFApp.StartMainProcess. Check the minibrowser demo.
Det20
Posts: 38
Joined: Fri Mar 10, 2017 3:11 pm

Re: Disable Mouse / Contextmenu

Post by Det20 »

Thank you. Do you know if flash is always supported by chromium with the given package or only if flash is installed by the user on the target system? It would be amazing if it always works, because not many users have installed flash player.
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Disable Mouse / Contextmenu

Post by salvadordf »

The users must install the PPAPI Flash plugin and GlobalCEFApp.FlashEnabled must be True (Default value).
That's why I had to add an extra FAQ item :
https://www.briskbard.com/index.php?lang=en&faqitem=208

Edit : If you show Youtube videos it could be enough with HTML5. I'm not 100% sure.
Det20
Posts: 38
Joined: Fri Mar 10, 2017 3:11 pm

Re: Disable Mouse / Contextmenu

Post by Det20 »

Do you know if it is possible to check, if flash is available for chromium by the application? For example, if not check flash then...
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Disable Mouse / Contextmenu

Post by salvadordf »

The users can check it here :
http://isflashinstalled.com/
https://www.whatismybrowser.com/detect/ ... -installed
http://www.adobe.com/software/flash/about/

If you need to check it in the code, you could read the list of installed programs in the registry.
http://delphiexamples.com/system/installprog.html
Post Reply