Page 1 of 1
ContextMenu supports ownerdraw?
Posted: Mon Feb 01, 2021 2:27 am
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?
Re: ContextMenu supports ownerdraw?
Posted: Mon Feb 01, 2021 8:21 am
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.
Re: ContextMenu supports ownerdraw?
Posted: Mon Feb 01, 2021 10:18 am
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?
Re: ContextMenu supports ownerdraw?
Posted: Tue Feb 02, 2021 8:37 am
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.
Re: ContextMenu supports ownerdraw?
Posted: Wed Feb 03, 2021 12:33 pm
by tad.chen
It works now. Thank you!
