Vassal v3.6 introduced a new feature that allows most types of Toolbar Button to be disabled by setting a Global Property true (and conversely, re-enabled if the Global Property is set non-true. As shown in this example of a map-level Global Key Command:
When the Global Property gNextDisabled
is set true, the image of the button appears greyed-out as shown here and does not respond. An alternative image can be specified if required.
The rest of this article shares some experience using this feature that I obtained whilst developing the Liberté module.
Map Buttons
The map configuration panel does not offer the “disable-on-global-property” feature. However, you can achieve the same effect by encapsulating each map button in a Toolbar Menu. This example controls a Player Hand window called “Blue”;
Conditional Buttons
The feature allows multiple buttons to be controlled from a single Action Button or hotkey without interfering with each other. For example, in a game with multiple Game Piece inventory Windows, a single Action Button can be used to activate the required inventory depending on the game state. In this case the Action Button provides the user interface (button image, hotkey) and the GPIWs have an internal hotkey and are enabled or disabled, each by a unique Global Property. Example below shows two GPIWs controlled by a single Action Button; the Global Properties gSpecialEnd
& gCRtallyOff
are set such that the controlling Action Button will only display one of the GPIWs (or none).
Control
The button control feature relies on the module designer to set each button’s Global Property at appropriate points in the game flow. Consider using the Change-Property feature (with Hotkeys) rather than the Set Global Property trait, as this might be easier to maintain. Also, because button control works through a fixed value (true or non-true) you may find that you need to create Global Properties in pairs, where one is always the opposite of the other.