The MainMenu component is non-visual (in development) and is used to create the form's main menu.
Several MainMenu components can be placed on one form, including different sets of commands. If this is the case, one of the component names should be set as a MainMenu property value.
After forming a list of menu items, properties and events can be defined for each menu item. Each item is an object of the MenuItem class which has a definite set of properties, methods and events.
Menu options are added when a form is developed. To add a menu option, find the MainMenu component on the Standard toolbar, and drag it to the form; the form looks like follows:
Clicking the MainMenu component shows the list of properties for this component in object inspector; select the Items property and click the button for this property. This opens the properties list for added menu element, where you should define values of the Text property. Label text may include the ampersand character & which underlines the next character corresponding to a hot key. After this the a new menu option with selected name appears, also new menu items and subitems become available:
To add new items, select the necessary Add Item element and set the value of the Text property for this item. After a menu has been created you can change the order of menu options on the menu panel using the Drag&Drop method.
You can configure common properties for the menu options on one hierarchy level. To do so, holding the CTRL key, select the necessary items and change the necessary properties in the object inspector.
You can assign one or several hotkey combinations to quickly perform menu commands. To assign hotkeys in the form designer mode, you need firstly to select an action in the object inspector, select the ShortCut property in object inspector and press the required combination. Additional hotkey combinations are set in the AdditionalShortCuts collection using the Fore language when executing the form.
After launching the form the menu looks as follows:
| Property name | Brief description | |
| AllowUndock | The AllowUndock property determines whether the user can undock menu during form execution. | |
| ComponentCount | The ComponentCount property returns the number of child components. | |
| Components | The Components property returns the child component. | |
| Data | The Data property stores any custom data. | |
| Images | The Images property determines name of the ImageList component, the image of which is used in the component. | |
| Items | The Items property returns the collection of menu items. | |
| Name | The Name property determines the component name. | |
| Tag | The Tag property is not used by the compiler. The user can change the value of the Tag property and use it as required. |
See also: