Navigation
API > API/Runtime > API/Runtime/UMG
The button is a click-able primitive widget to enable basic interaction, you can place any other widget inside a button to make a more complex and interesting click-able element in your UI.
- Single Child
- Clickable
| Name | UButton |
| Type | class |
| Header File | /Engine/Source/Runtime/UMG/Public/Components/Button.h |
| Include Path | #include "Components/Button.h" |
Syntax
UCLASS (MinimalAPI)
class UButton : public UContentWidget
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UVisual → UWidget → UPanelWidget → UContentWidget → UButton
Implements Interfaces
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UButton
(
const FObjectInitializer& ObjectInitializer |
Components/Button.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| BackgroundColor | FLinearColor | The color multiplier for the button background | Components/Button.h |
|
| ClickMethod | TEnumAsByte< EButtonClickMethod::Type > | The type of mouse action required by the user to trigger the buttons 'Click' | Components/Button.h |
|
| ColorAndOpacity | FLinearColor | The color multiplier for the button content | Components/Button.h |
|
| IsFocusable | bool | Sometimes a button should only be mouse-clickable and never keyboard focusable. | Components/Button.h |
|
| OnButtonDragDetected | FOnDragDetected | Delegate triggered when a user starts to drag a button | Components/Button.h | |
| OnButtonDragEnter | FOnDragEnter | Delegate triggered when a user's drag enters the bounds of this button | Components/Button.h | |
| OnButtonDragLeave | FOnDragLeave | Delegate triggered when a user's drag leaves the bounds of this button | Components/Button.h | |
| OnButtonDragOver | FOnDragOver | Delegate triggered when a user's drag leaves the bounds of this button | Components/Button.h | |
| OnButtonDrop | FOnDrop | Delegate triggered when a user's drag is dropped in the bounds of this button | Components/Button.h | |
| OnClicked | FOnButtonClickedEvent | Called when the button is clicked | Components/Button.h |
|
| OnHovered | FOnButtonHoverEvent | Components/Button.h |
|
|
| OnLostFocus | FSimpleDelegate | Called when the button loses focus | Components/Button.h | |
| OnPressed | FOnButtonPressedEvent | Called when the button is pressed | Components/Button.h |
|
| OnReceivedFocus | FSimpleDelegate | Called when the button receives focus | Components/Button.h | |
| OnReleased | FOnButtonReleasedEvent | Called when the button is released | Components/Button.h |
|
| OnUnhovered | FOnButtonHoverEvent | Components/Button.h |
|
|
| PressMethod | TEnumAsByte< EButtonPressMethod::Type > | The type of keyboard/gamepad button press action required by the user to trigger the buttons 'Click' | Components/Button.h |
|
| TouchMethod | TEnumAsByte< EButtonTouchMethod::Type > | The type of touch action required by the user to trigger the buttons 'Click' | Components/Button.h |
|
| WidgetStyle | FButtonStyle | The button style used at runtime | Components/Button.h |
|
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FLinearColor GetBackgroundColor() |
Components/Button.h | ||
EButtonClickMethod::Type GetClickMethod() |
Components/Button.h | ||
FLinearColor GetColorAndOpacity() |
Components/Button.h | ||
bool GetIsFocusable() |
Components/Button.h | ||
EButtonPressMethod::Type GetPressMethod() |
Components/Button.h | ||
const FButtonStyle & GetStyle() |
Components/Button.h | ||
EButtonTouchMethod::Type GetTouchMethod() |
Components/Button.h | ||
bool IsPressed () |
Returns true if the user is actively pressing the button. | Components/Button.h |
|
void SetAllowDragDrop
(
bool bInAllowDragDrop |
Components/Button.h |
|
|
void SetBackgroundColor
(
FLinearColor InBackgroundColor |
Sets the color multiplier for the button background | Components/Button.h |
|
void SetClickMethod
(
EButtonClickMethod::Type InClickMethod |
Components/Button.h |
|
|
void SetColorAndOpacity
(
FLinearColor InColorAndOpacity |
Sets the color multiplier for the button content | Components/Button.h |
|
void SetPressMethod
(
EButtonPressMethod::Type InPressMethod |
Components/Button.h |
|
|
void SetStyle
(
const FButtonStyle& InStyle |
Sets the color multiplier for the button background | Components/Button.h |
|
void SetTouchMethod
(
EButtonTouchMethod::Type InTouchMethod |
Components/Button.h |
|
Overridden from UWidget
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual const FText GetPaletteCategory() |
Gets the palette category of the widget | Components/Button.h | |
virtual void SynchronizeProperties () |
Applies all properties to the native widget if possible. | Components/Button.h |
Overridden from UVisual
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void ReleaseSlateResources
(
bool bReleaseChildren |
Components/Button.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void PostLoad() |
Begin UObject. | Components/Button.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void InitIsFocusable
(
bool InIsFocusable |
Initialize IsFocusable in the constructor before the SWidget is constructed. | Components/Button.h | |
FReply SlateHandleClicked() |
Handle the actual click event from slate and forward it on | Components/Button.h | |
FReply SlateHandleDragDetected
(
const FGeometry& MyGeometry, |
Drag and Drop. | Components/Button.h | |
void SlateHandleDragEnter
(
const FGeometry& MyGeometry, |
Components/Button.h | ||
void SlateHandleDragLeave
(
const FDragDropEvent& DragDropEvent |
Components/Button.h | ||
FReply SlateHandleDragOver
(
const FGeometry& MyGeometry, |
Components/Button.h | ||
FReply SlateHandleDrop
(
const FGeometry& MyGeometry, |
Components/Button.h | ||
void SlateHandleHovered() |
Components/Button.h | ||
void SlateHandleOnLostFocus() |
Components/Button.h | ||
void SlateHandleOnReceivedFocus() |
Components/Button.h | ||
void SlateHandlePressed() |
Components/Button.h | ||
void SlateHandleReleased() |
Components/Button.h | ||
void SlateHandleUnhovered() |
Components/Button.h |
Overridden from UPanelWidget
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual UClass * GetSlotClass() |
UPanelWidget. | Components/Button.h | |
virtual void OnSlotAdded
(
UPanelSlot* Slot |
Components/Button.h | ||
virtual void OnSlotRemoved
(
UPanelSlot* Slot |
Components/Button.h |
Overridden from UWidget
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual TSharedPtr< SWidget > GetAccessibleWidget() |
Gets the widget that accessibility properties should synchronize to. | Components/Button.h | |
virtual TSharedRef< SWidget > RebuildDesignWidget
(
TSharedRef< SWidget > Content |
Components/Button.h | ||
virtual TSharedRef< SWidget > RebuildWidget() |
Function implemented by all subclasses of UWidget is called when the underlying SWidget needs to be constructed. | Components/Button.h |