Aztec® Programming Language
Version 1.1 Alpha 2

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

Download Aztec

Search        Contact Us

He danced for those at minstrel shows and county fairs...

Throughout the South.

- Jerry Jeff Walker

 

aztec.ui.Button

public abstract class Button from<Control>

Base

Window

Control

Button

aztec.ui.IButton

public abstract class IButton from<Base>

Base

IButton

Button is an abstract class which provides a general framework for a button control. The button can consist of text and/or a bitmap, and it supports an event to get control when the button is clicked.

 

Aztec currently supports two different types of buttons (derived from this class) - push buttons (PushButton) and toggle buttons (ToggleButton).

 

The push button does not maintain any state. It can be clicked and when released, a button click event occurs.

 

The toggle button maintains an on/off check state and supports a "radio flag". If the radio flag is false, the button's "check state" is clicked on and off independently of other buttons. If the radio flag is true, clicking the button's check state affects other radio buttons at the same level (same parent). Only one radio button can be on at a time, so when one is clicked on, all others are checked off.

 

The toggle button also supports a "push-like" flag. If false, the button is presented as text preceded by either a square check box (radio is false) or a circular check box (radio is true). If "push like" is true, the button is presented as a push button that stays in when checked, and stays out when not checked.

 

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

Button Methods

Button() Constructor for the Button class
AddButtonClickHandler() Registers an event handler for a button click event using a method reference
AddButtonClickHandler() Registers an event handler for a button click event using an IButton reference
OnButtonClick() Virtual method to handle ButtonClick events - can be overridden

IButton Methods

OnButtonClick() Virtual method to handle ButtonClick events

Derived Classes

See Also

 


Button()

public method Button(Window Parent, int XPos, int YPos, int Width, int Height, string Label, BitMap ButtonIcon = null)

Parameters

Parent

Parent window for the button control

XPos

One based X position of control relative to parent

YPos

One based Y position of control relative to parent

Width

Initial width of the control in pixels

Height

Initial height of the control in pixels

Label

String to be used for the Button control

ButtonIcon

Bitmap to embed in the button (or null)

Return Value

None

Description

Constructor for the Button class.

 

Note that the Bitmap object is currently not supported for buttons, but this feature will be added soon.

 

Button Class


AddButtonClickHandler()

public method AddButtonClickHandler(ButtonClickHandler 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 method registers a method reference to be executed when a "button click" event occurs within the Button object.

 

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 ButtonClickHandler data type represents a method reference specific to a handler for ButtonClickEvent. ButtonClickHandler is defined as follows:

 

        public type<method<ButtonClickEvent,Base>> ButtonClickHandler

 

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

 

        public method ButtonClickMethod(ButtonClickEvent event, Base Extra) { }.

 

Button Class


AddButtonClickHandler()

public method AddButtonClickHandler(IButton Interface, Base ExtraObject = null)

Parameters

Interface

Reference to an IButton 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 IButton interface object to be executed when a "button click" event occurs for this Button control. 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 button is clicked, the OnButtonClick() method within the IButton object will be executed.

 

Button Class


OnButtonClick()

public method virtual OnButtonClick(ButtonClickEvent ClickEvent, Base ExtraObject)

Parameters

ClickEvent

ButtonClickEvent object associated with the event

ExtraObject

Optional object sent along from when it was registered

Return Value

NONE

Description

This method is the default event handler for ButtonClickEvent for the Button control. This method in turn executes every registered handler with the same argument list which comes in. Both implementations of the Button.AddButtonClickHandler() method register the event handlers which get invoked by this method.

 

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

 

Button Class


OnButtonClick()

public method virtual OnButtonClick(ButtonClickEvent ClickEvent, Base ExtraObject)

Parameters

ClickEvent

ButtonClickEvent 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 ButtonClickEvent within the IButton interface class. The method which overrides it is invoked for ButtonClickEvent within a Button object when the interface object is registered with the Button.AddButtonClickHandler() method.

 

IButton Class

 

Copyright © 2010-2017

Aztec Development Group

All Rights Reserved

Download Aztec