Aztec® Programming Language
Version 1.1 Alpha 2

Copyright © 2010-2017, Aztec Development Group, All Rights Reserved

Download Aztec

Search        Contact Us

Hope I die before I get old.

- Pete Townshend

 

aztec.ui.MenuItem

public class MenuItem from<SelectItem>

Base

Window

SelectItem

MenuItem

aztec.ui.IMenuItem

public class abstract IMenuItem from<Base>

Base

IMenuItem

The MenuItem class provides a selectable item for menus. Menus and toolbars are handled in a similar way. Each contains items which can be "selected" in order to accomplish a task (derived from SelectItem class). This allows the same event handlers to be used for menus and toolbars.

 

The IMenuItem class is an abstract interface class which contains a virtual event handler method for each of the events which the MenuItem class supports.

 

A single MenuBar object (or an object derived from it) is the only valid child window for the MenuItem class.

Valid Child Windows for MenuItem

MenuItem Methods

MenuItem() Constructor for the MenuItem class
ChildMenu() Method to return reference to MenuBar attached to this item as a sub menu (can be null)
ParentMenu() Method to return reference to MenuBar which contains this menu item
Enable() Virtual method to enable the item
Disable() Virtual method to disable the item
IsEnabled() Virtual method to return true if the item is enabled
IsDisabled() Virtual method to return true if the item is disabled
Check() Virtual method to check the item
Gray() Virtual method to gray out the item
IsChecked() Virtual method to return true if the item is checked
IsGrayed() Virtual method to return true if the item is grayed out
SetPosition() Virtual method to set the one based position of the menu item
Position() Virtual method to get the one based position of the item
AddMenuShowHandler() Virtual method to register an event handler for a menu show event using a method reference
AddMenuShowHandler() Virtual method to register an event handler for a menu show event using an IMenuItem reference
AddItemSelectHandler() Virtual method to register an event handler for an item select event using a method reference
AddItemSelectHandler() Virtual method to register to an event handler for an item select event using an ISelectItem reference
OnMenuShow() Virtual method to handle MenuShow events - can be overridden
OnItemSelect() Virtual method to handle ItemSelect events - can be overridden

IMenuItem Methods

OnMenuShow() Virtual method to handle MenuShow events

Derived Classes

See Also

 


MenuItem()

public method MenuItem(Window Parent, string Label, BitMap ItemImage = null, bool AutoCheck = false, int Index = 0)

Parameters

Parent

Parent window of the menu item

Label

Text to be entered in the menu item

ItemImage

Image to be displayed in the menu item (can be null)

AutoCheck

Handle check processing automatically in the menu item

Index

One based index for location of new item (0 means append)

Return Value

None

Description

Constructor for the MenuItem class. The parent must be specified, and it must be a MenuBar type. If "AutoCheck" flag is set, the menu item object will automatically turn a check on or off as the menu item is selected. If the index is one or greater, the item is placed in that position (if valid), otherwise the item is placed at the end of the menu item list.

 

MenuItem Class


ChildMenu()

public method<MenuBar> ChildMenu()

Parameters

None

Return Value

Child menu attached to this menu item or null

Description

This method returns a reference to the MenuBar object attached to this menu item as a sub menu. If there is no sub menu attached to this menu item, this method will return null.

 

MenuItem Class


ParentMenu()

public method<MenuBar> ParentMenu()

Parameters

None

Return Value

Parent menu which contains this menu item

Description

This method returns a reference to the MenuBar object which contains this menu item object. This will always be a valid MenuBar reference.

 

MenuItem Class


Enable()

public virtual method Enable()

Parameters

None

Return Value

None

Description

This method enables the item, which makes the item selectable and it is displayed using normal text.

 

MenuItem Class


Disable()

public virtual method Disable()

Parameters

None

Return Value

None

Description

This method disbles the item, which makes the item NOT selectable. The item is still displayed using normal text.

 

MenuItem Class


IsEnabled()

public virtual method<bool> IsEnabled()

Parameters

None

Return Value

True if checked

Description

This method returns true if the item is currently enabled (normal text and IS selectable) and false if not enabled.

 

MenuItem Class


IsDisabled()

public virtual method<bool> IsDisabled()

Parameters

None

Return Value

True if checked

Description

This method returns true if the item is currently disabled (normal text but NOT selectable) and false if not enabled.

 

MenuItem Class


Check()

public virtual method Check(bool CheckState = true)

Parameters

CheckState

Checked if true and not checked if false

Return Value

None

Description

This method is used to check the item or uncheck the item. If CheckState is true, the item becomes checked, and if false, it becomes unchecked.

 

MenuItem Class


Gray()

public virtual method Gray()

Parameters

None

Return Value

None

Description

This method grays out and disables the item, which makes the item NOT selectable.

 

MenuItem Class


IsChecked()

public virtual method<bool> IsChecked()

Parameters

None

Return Value

True if checked

Description

This method returns true if the item is currently checked and false if not checked.

 

MenuItem Class


IsGrayed()

public virtual method<bool> IsGrayed()

Parameters

None

Return Value

True if checked

Description

This method returns true if the item is currently grayed out (grayed and NOT selectable) and false if not grayed out.

 

MenuItem Class


SetPosition()

public virtual method<int> SetPosition(int Position)

Parameters

Position

One based position to put this item in

Return Value

Old one based position

Description

This virtual method sets the one based position for the menu item within the menu bar that it's attached to.

 

MenuItem Class


Position()

public virtual method<int> Position()

Parameters

None

Return Value

One based position

Description

This method returns the one based position of this item within the menu bar that it's attached to.

 

MenuItem Class


AddMenuShowHandler()

public virtual method AddMenuShowHandler(MenuShowHandler Handler, Base ExtraObject = null)

Parameters

Handler

Method reference to be executed when the event occurs

ExtraObject

Optional object which will be sent along to each event handler when it is executed

Return Value

NONE

Description

This virtual method registers a method reference to be executed when a "menu show" event occurs within the menu item. Each time the menu that the item is attached to is displayed, this event will be sent. This allows each menu item to manually update status if appropriate. An optional object can also be registered which will be sent to each event handler as it is executed.

 

As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So an event sent to one thread can be handled by event handlers executing in one or more other threads.

 

The MenuShowHandler data type represents a method reference specific to a handler for MenuShowEvent. MenuShowHandler is defined as follows:

 

        public type<method<MenuShowEvent,Base>> MenuShowHandler

 

Given this definition, the method handler must be defined with the following signature (name can be anything):

 

        public method MenuShowMethod(MenuShowEvent event, Base Extra) { }.

 

MenuItem Class


AddMenuShowHandler()

public virtual method AddMenuShowHandler(IMenuItem Interface, Base ExtraObject = null)

Parameters

Interface

Reference to an IMenuItem object

ExtraObject

Optional object which will be sent along to each event handler when it is executed

Return Value

NONE

Description

This virtual method registers an IMenuItem interface object to be executed when a "menu show" event occurs for this menu item. An optional object can also be registered which will be sent to each event handler as it is executed.

 

As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So an event sent to one thread can be handled by event handlers executing in one or more other threads.

 

When the menu item is displayed, the OnMenuShow() method within the IMenuItem object will be executed.

 

MenuItem Class


AddItemSelectHandler()

public virtual method AddItemSelectHandler(ItemSelectHandler Handler, Base ExtraObject = null)

Parameters

Handler

Method reference to be executed when the event occurs

ExtraObject

Optional object which will be sent along to each event handler when it is executed

Return Value

NONE

Description

This virtual method registers a method reference to be executed when an "item select" event occurs within the select item. An optional object can also be registered which will be sent to each event handler as it is executed.

 

As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So an event sent to one thread can be handled by event handlers executing in one or more other threads.

 

The ItemSelectHandler data type represents a method reference specific to a handler for ItemSelectEvent. ItemSelectHandler is defined as follows:

 

        public type<method<ItemSelectEvent,Base>> ItemSelectHandler

 

Given this definition, the method handler must be defined with the following signature (name can be anything):

 

        public method ItemSelectMethod(ItemSelectEvent event, Base Extra) { }.

 

MenuItem Class


AddItemSelectHandler()

public virtual method AddItemSelectHandler(ISelectItem Interface, Base ExtraObject = null)

Parameters

Interface

Reference to an ISelectItem object

ExtraObject

Optional object which will be sent along to each event handler when it is executed

Return Value

NONE

Description

This method registers an ISelectItem interface object to be executed when an "item select" event occurs with this item. An optional object can also be registered which will be sent to each event handler as it is executed.

 

As is true with all Aztec event handling, this method can be called by any thread. When the event occurs, each registered event handler is scheduled to execute within the thread that registered it. So an event sent to one thread can be handled by event handlers executing in one or more other threads.

 

When the item is selected, the OnItemSelect() method within the ISelectItem object will be executed.

 

MenuItem Class


OnMenuShow()

public virtual method OnMenuShow(MenuShowEvent ShowEvent, Base ExtraObject)

Parameters

ShowEvent

MenuShowEvent object associated with the event

ExtraObject

Optional object sent along from when it was registered

Return Value

NONE

Description

This method is the event handler for MenuShowEvent for the menu item. It is invoked internally when the menu item is displayed. This method in turn executes every registered handler with the same argument list which comes in. Both implementations of the MenuItem.AddMenuShowHandler() method register the event handlers which get invoked by this method.

 

If this method is overridden by a class derived from MenuItem, it must call this implementation of the method if it needs to execute handlers registered with the MenuItem.AddMenuShowHandler() methods.

 

MenuItem Class


OnItemSelect()

public virtual method OnItemSelect(ItemSelectEvent SelectEvent, Base ExtraObject)

Parameters

SelectEvent

ItemSelectEvent object associated with the event

ExtraObject

Optional object sent along from when it was registered

Return Value

NONE

Description

This method is the event handler for ItemSelectEvent within the select item. It is invoked internally when the item is selected by the user. This method in turn executes every registered handler with the same argument list which comes in. Both implementations of the SelectItem.AddItemSelectHandler() method register the event handlers which get invoked by this method.

 

If this method is overridden by a class derived from MenuItem, it must call this implementation of the method if it needs to execute handlers registered with the MenuItem.AddItemSelectHandler() methods.

 

MenuItem Class


OnMenuShow()

public method virtual OnMenuShow(MenuShowEvent ShowEvent, Base ExtraObject)

Parameters

ShowEvent

MenuShowEvent object associated with the event

ExtraObject

Optional object sent along from when it was registered

Return Value

NONE

Description

This virtual method is the event handler for MenuShowEvent within the IMenuItem interface class. The method which overrides it is invoked for MenuShowEvent within a MenuItem object when the interface object is registered with the MenuItem.AddMenuShowHandler() method.

 

IMenuItem Class

 

Copyright © 2010-2017

Aztec Development Group

All Rights Reserved

Download Aztec