- Jerry Jeff Walker
Button
IButton
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
Class Hierarchy, Frame, ChildFrame, Dialog, ButtonClickEvent, BitMap
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
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
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
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
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