Aztec® Programming Language
Version 1.1 Alpha 2

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

Download Aztec

Search        Contact Us

It turns me on to think of growing old.

- John Denver

 

aztec.ui.ToolBarItem

public class ToolBarItem from<SelectItem>

Base

Window

SelectItem

ToolBarItem

The ToolBarItem class provides a selectable item for toolbars. 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.

ToolBarItem Methods

ToolBarItem() Constructor for theToolBarItem class
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
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
OnItemSelect() Virtual method to handle ItemSelect events - can be overridden

Derived Classes

See Also

 


ToolBarItem()

public method ToolBarItem(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 toolbar item (can be null)

AutoCheck

Handle check processing automatically in the toolbar item

Index

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

Return Value

None

Description

Constructor for the ToolBarItem class. The parent must be specified, and it must be a ToolBarBar type. If "AutoCheck" flag is set, the toolbar item object will automatically turn a check on or off as the toolbar 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 toolbar item list.

 

ToolBarItem 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.

 

ToolBarItem 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.

 

ToolBarItem 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.

 

ToolBarItem 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.

 

ToolBarItem 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.

 

ToolBarItem 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.

 

ToolBarItem 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.

 

ToolBarItem 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.

 

ToolBarItem 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.

 

ToolBarItem 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.

 

ToolBarItem 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) { }.

 

ToolBarItem 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.

 

ToolBarItem 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 ToolBarItem, it must call this implementation of the method if it needs to execute handlers registered with the ToolBarItem.AddItemSelectHandler() methods.

 

ToolBarItem Class

 

Copyright © 2010-2017

Aztec Development Group

All Rights Reserved

Download Aztec