Who or what inserts the Unicode, right-to-left and IME items at the foot of the default right-click popup menu in Delphi 2010 VCL applications? I would like to remove them for user environments where they are unlikely ever to be needed, without having to define a custom pop-up menu for every edit and memo. Most of the time only copy, cut, paste and select all are appropriate.
Delphi – How to remove items from the default right-click menu in Delphi 2010
delphidelphi-2010vcl
Related Solutions
Here's the list of compiler versions:
{$IFDEF VER40} - Turbo pascal 4
{$IFDEF VER50} - Turbo pascal 5
{$IFDEF VER55} - Turbo pascal 5.5
{$IFDEF VER60} - Turbo pascal 6
{$IFDEF VER70} - Borland pascal 7 (And turbo pascal 1.5 for windows)
{$IFDEF VER80} - Delphi 1
{$IFDEF VER90} - Delphi 2
{$IFDEF VER100} - Delphi 3
{$IFDEF VER120} - Delphi 4
{$IFDEF VER130} - Delphi 5
{$IFDEF VER140} - Delphi 6
{$IFDEF VER150} - Delphi 7
{$IFDEF VER160} - Delphi 8
{$IFDEF VER170} - Delphi 2005
{$IFDEF VER180} - Delphi 2006
{$IFDEF VER180} - Delphi 2007
{$IFDEF VER185} - Delphi 2007
{$IFDEF VER200} - Delphi 2009
{$IFDEF VER210} - Delphi 2010
{$IFDEF VER220} - Delphi XE
{$IFDEF VER230} - Delphi XE2
{$IFDEF VER240} - Delphi XE3
{$IFDEF VER250} - Delphi XE4
{$IFDEF VER260} - Delphi XE5
{$IFDEF VER265} - Appmethod 1.0
{$IFDEF VER270} - Delphi XE6
{$IFDEF VER280} - Delphi XE7
{$IFDEF VER290} - Delphi XE8
{$IFDEF VER300} - Delphi 10 Seattle
{$IFDEF VER310} - Delphi 10.1 Berlin
{$IFDEF VER320} - Delphi 10.2 Tokyo
In Delphi 2007, VER180
and VER185
are both defined. This was for backward compatibility with Delphi 2006, and to make sure you could also detect D2007 specifically.
I'm not sure why they did that between '06 and '07, but not for other releases. Seems inconsistent to me (but it isn't - see Barry Kelly's comment below).
- Drag and drop a ActionManager, a ActionMainMenuBar and a ImageList on your form.
- Doubleclick the ImageList, you get the Imagelist Editor. Use the Add-button to add your icons (make sure their sizes are the same as the Height and Width properties that are set in the ImageList-control).
- Set the Images-property of the ActionManager to your ImageList and set the ActionManager-property of your ActionMainMenuBar to your ActionManager.
- Doubleclick the ActionManager, go to the tab 'Actions' and add new actions by the 'New'-button.
- Click each Action in the ActionManager and set each action's properties, at least: ImageIndex (to choose an Icon), Caption and Category. Note: A Category will serve as a main item in the menu (like File, Edit and View) and each Action will serve as menu item (like Save, Save as, Load). So set the Category property of all actions you want to belong to one main menu item to the same name. For instance give the actions 'Save' and 'Load' the category 'File' and give the actions 'Undo' and 'Redo' the category 'Edit'.
- Doubleclick each Action in the ActionManager. You'll get the code editor. Type the code you want to perform when the user clicks this menu item. If you don't type any code or comment, the menu item will automatically be disabled when the application is running.
- Now drag the categories from the ActionManager to the ActionMainMenuBar.
That's it.
Best Answer
The OS inserts them. The entire menu is generated by the underlying Windows control, not by Delphi.
To have a different menu, provide your own
TPopupMenu
component, set the control'sPopupMenu
property, and provide whatever menu items you want.