Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


 

Introduced in

Version:1.00

Description

Description:

Defines the action that is executed when a button or an active text control is clicked.

The defined command can use variables local to that action, as well as (_this select 0), to refer to the control itself (only available for ActiveText controls and buttons in V3.6+).

Syntax

Syntax:buttonSetAction [idc, action]
Parameters:
Return Value:Nothing

Alternative Syntax

Syntax:control buttonSetAction action
Parameters:
Return Value:Nothing

Examples

Examples:
buttonSetAction [100, "player execVM 'reply.sqf'"]
_ctnCtrl buttonSetAction "_txt = ctrlText (_this select 0); player sidechat _txt"

Additional Information

See also: buttonAction, ctrlActivate, VBS Displays
Multiplayer:
Problems:In V2.x the "_this" variable is not populated, and can therefore not be used.

Notes







Posted on October 26, 2011
Kronzky
To use variables local to the defining script, a syntax like the one below needs to be used:


_foo = "foo";
buttonSetAction [100, format["hint '%1 bar'", _foo]];