Bind.bind

Bind a callback to a particular event triggered by this item. This command is identical to UiElement's bind method.

If bindings have been created for a canvas widget they are invoked in addition to bindings created for the canvas's items. The bindings for items will be invoked before any of the bindings for the window as a whole.

mixintemplate Bind()
bind
(
this T
)
(
string binding
,
CommandCallback callback
)

Parameters

binding string

The binding that triggers this event. See below.

callback CommandCallback

The delegate callback to execute when the event triggers.

Return Value

Type: auto

This item to aid method chaining.

Bindings: The only events for which bindings may be specified are those related to the mouse and keyboard (such as Enter, Leave, ButtonPress, Motion, and KeyPress) or virtual events.

Callback Arguments

These are the fields within the callback's CommandArgs parameter which are populated by this method when the callback is executed.

$(PARAM_TABLE $(PARAM_ROW CommandArgs.element, The item that executed the callback.) $(PARAM_ROW CommandArgs.uniqueData, The binding that was responded to.) $(PARAM_ROW CommandArgs.callback, The callback which was executed.) $(PARAM_ROW CommandArgs.event.button, The number of any button that was pressed.) $(PARAM_ROW CommandArgs.event.keyCode, The key code of any key pressed.) $(PARAM_ROW CommandArgs.event.x, The horizontal position of the mouse relative to the widget.) $(PARAM_ROW CommandArgs.event.y, The vertical position of the mouse relative to the widget.) $(PARAM_ROW CommandArgs.event.wheel, Mouse wheel delta.) $(PARAM_ROW CommandArgs.event.key, Key symbol of any key pressed.) $(PARAM_ROW CommandArgs.event.screenX, The horizontal position of the mouse relative to the screen.) $(PARAM_ROW CommandArgs.event.screenY, The vertical position of the mouse relative to the screen.) )

See Also

Meta