Skip to content

Menu Bar in your PHP application

The menu bar component displays the standard GUI menus at the top side of the main window. By default, an application contains four pre-defined menu items: File, Edition, Navigate and Help with various menu commands that let your end users navigate through your web pages, select and copy text parts, print pages...

To create a menu bar in your PHP application, add a Menu Bar to the "Components Used" list and then click Edit Menu.

The UI editor is shown and includes a ready-to-use menu that you can modify.

The UI editor allows you to manage menu items, associate commands with them and configure their properties. You can also reorder these items.

Manage menu items

  • Select the MainMenu1 control (TMainMenu type)

Select the MainMenu1 control

  • In the Properties Editor, double-click on (Menu) corresponding to the Items property

In the Properties Editor, double-click on (Menu) corresponding to the Items property

  • Use the Menu Editor tree to manage menu items:

For the Caption property, you can use Resource Strings for easier localization. To insert a resource string, use %RESID% and replace RESID with the name of the resource string.

Specify a hyphen character (-) as the value of Caption for the menu item to indicate that the menu item is a separator.

Separators should have their action set to "Do nothing".

when the menu is displayed in the compiled app, it does not show the caption but rather the name of the action,

If you associate a standard action to a menu, the menu's Caption property will be ignored: when the menu is displayed in the compiled app, it will show the name of the action. You can modify action names in the Localization editor.

Modify a menu item at runtime

It's possible to change any property of any menu item at runtime.

Refer to the dedicated topic "How To Modify Controls At Runtime".