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.

ContextMenu supports ownerdraw?

Post Reply
tad.chen
Posts: 104
Joined: Fri Jan 04, 2019 1:39 am

ContextMenu supports ownerdraw?

Post by tad.chen »

In OSR mode, how to ownerdraw the contextmenu? I want to use my own UI style of menu, not the default. I know the tpopupmenu control in delphi supports ownerdraw mode. Does contextmenu support?
Last edited by tad.chen on Mon Feb 01, 2021 10:23 am, edited 1 time in total.
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: ContextMenu supports ownerdraw?

Post by salvadordf »

These are the context menu events in CEF :
https://magpcss.org/ceforum/apidocs3/projects/(default)/CefContextMenuHandler.html

You can call model.clear inside the TChromium.OnBeforeContextMenu event to disable the context menu.
Then you can show your own custom menu.
tad.chen
Posts: 104
Joined: Fri Jan 04, 2019 1:39 am

Re: ContextMenu supports ownerdraw?

Post by tad.chen »

Thank you! But how to send command to web page if user select such as 'cut' or 'select all' item in my ownerdraw menu?
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: ContextMenu supports ownerdraw?

Post by salvadordf »

I can only suggest that you try these procedures :
  • TChromiumCore.ClipboardCopy;
  • TChromiumCore.ClipboardPaste;
  • TChromiumCore.ClipboardCut;
  • TChromiumCore.ClipboardUndo;
  • TChromiumCore.ClipboardRedo;
  • TChromiumCore.ClipboardDel;
  • TChromiumCore.SelectAll;
If this is not what you need then you might have to keep using the original context menu.
tad.chen
Posts: 104
Joined: Fri Jan 04, 2019 1:39 am

Re: ContextMenu supports ownerdraw?

Post by tad.chen »

It works now. Thank you! :D
Post Reply