GtkMenuItem Constructor

GtkMenuItem Constructor

GtkMenuItem ([string label ]);

The syntax

will create a single item in a menu with the label Edit. However this label is really a GtkAccelLabel, and has the ability to display any keyboard shortcuts - known as accelerators - associated with it.

For more information on setting up accelerator display in this way, see add_accelerator() . There is also a working example in the GtkMenu constructor section of this manual.

Underlining an accelerator key within the label text is a separate issue, and can be achieved by calling the GtkLabel method parse_uline() from the accelerator label. A string passed using this method will overwrite any existing text in the label.

Much of the above is to some extent automated in the GtkItemFactory API, and different methods may apply when setting up a GtkItemFactory-generated menu.

Note that it is not possible to add a GtkHSeparator object to either a GtkMenuItem or a GtkMenu. The current workaround for this is to create an empty menu item and then toggle its sensitivity so that it cannot be inadvertently selected by the end user:

© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.