<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://community.bistudio.com/wiki?action=history&amp;feed=atom&amp;title=Arma_Reforger%3AModular_Button_Component_Tutorial</id>
	<title>Arma Reforger:Modular Button Component Tutorial - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://community.bistudio.com/wiki?action=history&amp;feed=atom&amp;title=Arma_Reforger%3AModular_Button_Component_Tutorial"/>
	<link rel="alternate" type="text/html" href="https://community.bistudio.com/wiki?title=Arma_Reforger:Modular_Button_Component_Tutorial&amp;action=history"/>
	<updated>2026-04-23T17:44:43Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.0</generator>
	<entry>
		<id>https://community.bistudio.com/wiki?title=Arma_Reforger:Modular_Button_Component_Tutorial&amp;diff=370632&amp;oldid=prev</id>
		<title>Lou Montana: Page creation</title>
		<link rel="alternate" type="text/html" href="https://community.bistudio.com/wiki?title=Arma_Reforger:Modular_Button_Component_Tutorial&amp;diff=370632&amp;oldid=prev"/>
		<updated>2025-01-16T17:57:10Z</updated>

		<summary type="html">&lt;p&gt;Page creation&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{TOC|side}}&lt;br /&gt;
The Modular button component is a system which consists of a button component itself and various effects attached to it.&lt;br /&gt;
The aim of the system is to separate the effect types (animation, opacity, color, text, image, ...) from when they can happen (on click, or hover, on toggle, on focus, ...).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
# Create a layout containing a Button widget{{Feature|informative|&lt;br /&gt;
The {{Link/Enfusion|armaR|SCR_ModularButtonComponent}} component is meant to be used on a button widget to control the look and properties of the underlying hierarchy, and to provide an API for other classes to interact.&lt;br /&gt;
}}&lt;br /&gt;
# Add the {{Link/Enfusion|armaR|SCR_ModularButtonComponent}} to the button - it is also possible to drag and drop a config of {{hl|SCR_ModularButtonComponent}} type&lt;br /&gt;
# Add Effects to the {{hl|Effects}} array the component provides. Effects represent the properties of widgets under the button that you want to change, and the events on which you want to change them&lt;br /&gt;
# Specify the name of the widget whose properties are to be changed, and what the new value for each state change or event should be&lt;br /&gt;
#* Different Effects offer different attributes, based on the type of property that will be modified.&lt;br /&gt;
#* Keep in mind that there is not really an underlying state machine for the button: when an event triggers, the Effect will apply the new value to the property, and that's it.&lt;br /&gt;
#* By using tags, you can give a custom identifier to the effects. The {{hl|SCR_ModularButtonComponent}} API then allows you to find effects through their tags and thus control which effects should be active at a time.&lt;br /&gt;
# Define the button's behaviour&lt;br /&gt;
#* These settings provide useful functionalities about how the button should behave in the UI hierarchy, from flagging itself as toggled when clicked, to moving focus to itself when hovered for consistent menu navigation between keyboard, mouse and gamepad.&lt;br /&gt;
#* A notable attribute is the Event Return Value one, which controls how interaction events from widgets are propagated up the hierarchy:&amp;lt;!--&lt;br /&gt;
--&amp;gt; flagging an interaction will prevent the event from being propagated, which is useful, for example, when nesting multiple interactable widgets inside each other so that the ones higher in the hierarchy do not receive the events generated by the lower ones.&lt;br /&gt;
# Use the hierarchy Prefab in other layouts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SCR_ModularButtonComponent ==&lt;br /&gt;
&lt;br /&gt;
The component itself is simple, it also has all the common usual ScriptInvokers for a button, such as Clicked, Toggled, Focused, Hovered, etc.&lt;br /&gt;
&lt;br /&gt;
=== Effect Attributes ===&lt;br /&gt;
{| class=&amp;quot;wikitable float-right&amp;quot;&lt;br /&gt;
|+ Available Effects&lt;br /&gt;
! Class !! Description&lt;br /&gt;
|-&lt;br /&gt;
| SCR_ButtonEffectColor&lt;br /&gt;
| Animates color&lt;br /&gt;
|-&lt;br /&gt;
| SCR_ButtonEffectImage&lt;br /&gt;
| Sets image texture for an image widget. Supports imageset too.&lt;br /&gt;
|-&lt;br /&gt;
| SCR_ButtonEffectOpacity&lt;br /&gt;
| Animates opacity&lt;br /&gt;
|-&lt;br /&gt;
| SCR_ButtonEffectPadding&lt;br /&gt;
| Animates padding&lt;br /&gt;
|-&lt;br /&gt;
| SCR_ButtonEffectPosition&lt;br /&gt;
| Animate/set position of a widget&lt;br /&gt;
|-&lt;br /&gt;
| SCR_ButtonEffectSize&lt;br /&gt;
| Animate/set size of a widget&lt;br /&gt;
|-&lt;br /&gt;
| SCR_ButtonEffectText&lt;br /&gt;
| Sets text of a text widget&lt;br /&gt;
|-&lt;br /&gt;
| SCR_ButtonEffectSound&lt;br /&gt;
| Plays a sound&lt;br /&gt;
|-&lt;br /&gt;
| SCR_ButtonEffectVisibility&lt;br /&gt;
| Sets a widget visible/invisible&lt;br /&gt;
|-&lt;br /&gt;
| SCR_ButtonEffectSlaveButton&lt;br /&gt;
| Passes events to another button within this button&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Enabled ====&lt;br /&gt;
Effect is enabled or disabled. When disabled, it ignores events.&lt;br /&gt;
&lt;br /&gt;
==== Events ====&lt;br /&gt;
Events to which this effect listens.&lt;br /&gt;
* STATE - events are always mutually exclusive. All buttons can be in one of these states: {{hl|DEFAULT}}, {{hl|HOVERED}}, {{hl|DISABLED}}. Toggle-buttons additionally have these states: {{hl|ACTIVATED}}, {{hl|ACTIVATED_HOVERED}}.&lt;br /&gt;
* EVENT - events are not exclusive and can happen in any combinations: {{hl|CLICKED}}, {{hl|FOCUS_GAINED}}, {{hl|FOCUS_LOST}}, {{hl|TOGGLED_ON}}, {{hl|TOGGLED_OFF}}.&lt;br /&gt;
&lt;br /&gt;
==== Input Devices ====&lt;br /&gt;
Input devices which this effect listens to. This is useful to implement different behaviour for gamepad and mouse control schemes.&lt;br /&gt;
&lt;br /&gt;
==== Widget Name ====&lt;br /&gt;
The name of widget which will be affected by this effect. Not all effects are required to have it. For instance, a Play Sound effect doesn't interact with any widgets.&lt;br /&gt;
&lt;br /&gt;
==== Tags ====&lt;br /&gt;
An effect can have many string tags. You can enable/disable/find effects by their tags. It is useful for more complex behaviours, for instance if a button must operate in multiple modes.&lt;br /&gt;
&lt;br /&gt;
==== Event-Specific Attributes ====&lt;br /&gt;
Typically effects should have an attribute per each event type. For instance, Color Effect will have 10 color attributes - one for each event type.&lt;br /&gt;
&lt;br /&gt;
=== Effect Title ===&lt;br /&gt;
&lt;br /&gt;
The effect's title sums up its properties, generated based on its settings, e.g:&lt;br /&gt;
&lt;br /&gt;
[[File:armar-modular button component effect title.png]]&lt;br /&gt;
&lt;br /&gt;
=== Runtime API ===&lt;br /&gt;
&lt;br /&gt;
Tags are very powerful when you need to implement many operation modes on the same button. You can just predefine different effects in layout and enable or disable them at runtime:&lt;br /&gt;
&amp;lt;enforce&amp;gt;&lt;br /&gt;
SCR_ButtonEffectBase FindEffect(string tag)				// returns first effect with given tag&lt;br /&gt;
array&amp;lt;SCR_ButtonEffectBase&amp;gt; FindAllEffects(string tag)	// returns all effects with given tag&lt;br /&gt;
array&amp;lt;SCR_ButtonEffectBase&amp;gt; GetAllEffects()				// returns all effects&lt;br /&gt;
void SetEffectsWithAnyTagEnabled(array&amp;lt;string&amp;gt; tags)	// enables all effects with at least one of the provided tags. Other effects are disabled.&lt;br /&gt;
void SetAllEffectsEnabled(bool enable)					// enables or disables all effects&lt;br /&gt;
&amp;lt;/enforce&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to change button effect's values to something that cannot be predefined.&lt;br /&gt;
In this case, call &amp;lt;enforce inline&amp;gt;effect.PropertiesChanged()&amp;lt;/enforce&amp;gt; after modifying properties, they will be re-applied according to the current state.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
; Simple animated toggle button&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
; Toggle button with animated sub-button&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
; Multi-state animated toggle button&lt;br /&gt;
:&lt;br /&gt;
&lt;br /&gt;
; Colour Effect Implementation&lt;br /&gt;
: See {{Link/Enfusion|armaR|SCR_ButtonEffectColor}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{GameCategory|armaR|Modding|Tutorials}}&lt;/div&gt;</summary>
		<author><name>Lou Montana</name></author>
	</entry>
</feed>