MenuItem

From REALbasicWiki

Jump to: navigation, search
Overall article skill Skill ranges from beginner (green) to expert (red)

The MenuItem class represents a menu item in a menu.

MenuItem class
Available on Mac OS X Linux Windows
General
Superclass Object
Interfaces none
Constants
Methods
Properties
Events

NOTE: You can get descriptions of the items above from the REALbasic documentation.


Contents

[edit] Sub Enable()

Sets the MenuItem's Enabled property to true. You call it in an EnableMenuItems event handler, or in the EnableMenu event handler of a MenuItem subclass.

[edit] Sub MenuItem()

Default constructor for the MenuItem class.

[edit] Sub MenuItem(text as String, tag as Variant = nil)

This second constructor allows you to set the text and tag.

[edit] Function Popup(x as Integer, y as Integer) as MenuItem

Displays the menu as a contextual menu at the x and y coordinates. The arguments are optional, and if omitted the menu will be displayed at the current cursor location. The MenuItem selected by the user is returned. The arguments are also global rather than being relative to the object handling the mouse event.

[edit] Properties

[edit] AutoEnable as Boolean

When AutoEnable is set to true, the corresponding menu item will be enabled if a menu handler exists for the menu item in the calling chain of the menu item. In MenuItem subclasses, the corresponding menu item will also be enabled if the Action event handler is implemented. AutoEnable is set to true by default.


[edit] Enabled as Boolean

If true, the corresponding menu item is enabled in the menu.

[edit] Tag as Variant

The Tag property allows you to store additional information with a MenuItem.


[edit] Text as String

This is the text displayed by the menu when it is opened by the user.

[edit] Visible as Boolean

When Visible is true, the menu item will be visible in the menu when opened by the user. True by default.

[edit] Events

[edit] Function Action() as Boolean

[edit] Sub EnableMenu()

[edit] Discussion

The MenuItem.Bold, Italic, and Underline properties were removed in REALbasic 2008r4.

[edit] Sample Code

Personal tools
related