Component:Button: Difference between revisions

From Resonite Wiki
→‎Usage: Removes legacy fields, adds new SendSlotEvents field, adds some more docs on fields.
Automated: update Fields, Categories
Line 17: Line 17:
{{Table ComponentFields
{{Table ComponentFields
|BaseColor|ColorX|The color that all other tints will be based on
|BaseColor|ColorX|The color that all other tints will be based on
|ColorDrivers|ColorDriver|A list of sets of colors. Each one points at another component's color, and determines how it looks normally, when highlighted, when pressed, and when disabled
|ColorDrivers|{{RootFieldType|SyncList`1|[[Type:ColorDriver|ColorDriver]]}}|TypeAdv1=true|A list of sets of colors. Each one points at another component's color, and determines how it looks normally, when highlighted, when pressed, and when disabled
|__legacy_NormalColor|ColorX|
|__legacy_HighlightColor|ColorX|
|__legacy_PressColor|ColorX|
|__legacy_DisabledColor|ColorX|
|__legacy_TintColorMode|ColorMode|
|__legacy_ColorDrive|{{RootFieldType|FieldDrive`1|[[Type:ColorX|ColorX]]}}|TypeAdv7=true|
|IsPressed|Bool|True if the button is being pressed
|IsPressed|Bool|True if the button is being pressed
|IsHovering|Bool|True if someone is hovering over the button
|IsHovering|Bool|True if someone is hovering over the button
Line 31: Line 37:
|PressPoint|Float2|The (x,y) coordinate where the button is being pressed
|PressPoint|Float2|The (x,y) coordinate where the button is being pressed
|SendSlotEvents|Bool|If set, all Pressing, Pressed, Released, HoverEnter, HoverStay, and HoverLeave events are sent to all [[IButtonPressReceiver]] components within this component's slot. Defaults to true.
|SendSlotEvents|Bool|If set, all Pressing, Pressed, Released, HoverEnter, HoverStay, and HoverLeave events are sent to all [[IButtonPressReceiver]] components within this component's slot. Defaults to true.
|Pressed|ButtonEventHandler|Delegate. If set, this function is called with the Pressed event. Defaults to unset.
|Pressed|{{RootFieldType|SyncDelegate`1|[[Type:ButtonEventHandler|ButtonEventHandler]]}}|TypeAdv19=true|Delegate. If set, this function is called with the Pressed event. Defaults to unset.
|Pressing|ButtonEventHandler|Delegate. If set, this function is called with the Pressing event. Defaults to unset.
|Pressing|{{RootFieldType|SyncDelegate`1|[[Type:ButtonEventHandler|ButtonEventHandler]]}}|TypeAdv20=true|Delegate. If set, this function is called with the Pressing event. Defaults to unset.
|Released|ButtonEventHandler|Delegate. If set, this function is called with the Released event. Defaults to unset.
|Released|{{RootFieldType|SyncDelegate`1|[[Type:ButtonEventHandler|ButtonEventHandler]]}}|TypeAdv21=true|Delegate. If set, this function is called with the Released event. Defaults to unset.
|HoverEnter|ButtonEventHandler|Delegate. If set, this function is called with the HoverEnter event. Defaults to unset.
|HoverEnter|{{RootFieldType|SyncDelegate`1|[[Type:ButtonEventHandler|ButtonEventHandler]]}}|TypeAdv22=true|Delegate. If set, this function is called with the HoverEnter event. Defaults to unset.
|HoverStay|ButtonEventHandler|Delegate. If set, this function is called with the HoverStay event. Defaults to unset.
|HoverStay|{{RootFieldType|SyncDelegate`1|[[Type:ButtonEventHandler|ButtonEventHandler]]}}|TypeAdv23=true|Delegate. If set, this function is called with the HoverStay event. Defaults to unset.
|HoverLeave|ButtonEventHandler|Delegate. If set, this function is called with the HoverLeave event. Defaults to unset.
|HoverLeave|{{RootFieldType|SyncDelegate`1|[[Type:ButtonEventHandler|ButtonEventHandler]]}}|TypeAdv24=true|Delegate. If set, this function is called with the HoverLeave event. Defaults to unset.
}}
}}


Line 47: Line 53:
== Related Components ==
== Related Components ==
</translate>
</translate>
[[Category:Components{{#translation:}}|Button (Component){{#translation:}}]]
[[Category:Components{{#translation:}}|Button]]
[[Category:ComponentStubs]]
[[Category:ComponentStubs]]
[[Category:Components:UIX:Interaction{{#translation:}}|Button (Component){{#translation:}}]]
[[Category:Components:UIX:Interaction{{#translation:}}|Button]]

Revision as of 21:39, 3 March 2024


This article or section is a Stub. You can help the Resonite Wiki by expanding it.


Component image 
Button component as seen in the Scene Inspector


Intoduction

A Button is a UIX component allows for users to click on its Rect. It provides visual feedback by altering the colors of graphics on the Rect, and is able to trigger several other components, such as Text Field, by using the Button Events system.

Usage

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
BaseColor ColorX The color that all other tints will be based on
ColorDrivers list of ColorDriver A list of sets of colors. Each one points at another component's color, and determines how it looks normally, when highlighted, when pressed, and when disabled
__legacy_NormalColor ColorX
__legacy_HighlightColor ColorX
__legacy_PressColor ColorX
__legacy_DisabledColor ColorX
__legacy_TintColorMode ColorMode
__legacy_ColorDrive field drive of ColorX
IsPressed Bool True if the button is being pressed
IsHovering Bool True if someone is hovering over the button
HoverVibrate VibratePreset How a controller should vibrate when hovering over this button
PressVibrate VibratePreset How a controller should vibrate when pressing this button
ClearFocusOnPress Bool If set, will defocus any currently focused TextEditor, DesktopInteractionRelay, or any other IFocusable when this button is pressed. Defaults to true.
PassThroughHorizontalMovement Bool Whether or not press-and-drag movement should be passed to higher components

(such as Scroll Rects)

PassThroughVerticalMovement Bool Whether or not press-and-drag movement should be passed to higher components

(such as Scroll Rects)

RequireLockInToPress Bool FIXME. Defaults to false.
RequireInitialPress Bool FIXME. Defaults to true.
PressPoint Float2 The (x,y) coordinate where the button is being pressed
SendSlotEvents Bool If set, all Pressing, Pressed, Released, HoverEnter, HoverStay, and HoverLeave events are sent to all IButtonPressReceiver components within this component's slot. Defaults to true.
Pressed ButtonEventHandler Delegate. If set, this function is called with the Pressed event. Defaults to unset.
Pressing ButtonEventHandler Delegate. If set, this function is called with the Pressing event. Defaults to unset.
Released ButtonEventHandler Delegate. If set, this function is called with the Released event. Defaults to unset.
HoverEnter ButtonEventHandler Delegate. If set, this function is called with the HoverEnter event. Defaults to unset.
HoverStay ButtonEventHandler Delegate. If set, this function is called with the HoverStay event. Defaults to unset.
HoverLeave ButtonEventHandler Delegate. If set, this function is called with the HoverLeave event. Defaults to unset.

Behavior

Examples

Related Components