UButton

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.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

UMG

Header

/Engine/Source/Runtime/UMG/Public/Components/Button.h

Include

#include "Components/Button.h"

Syntax

class UButton : public UContentWidget

Remarks

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

Variables

Name Description

Public variable

FLinearColor

 

BackgroundColor

The color multiplier for the button background

Public variable

TEnumAsByte< EB...

 

ClickMethod

The type of mouse action required by the user to trigger the buttons 'Click'

Public variable

FLinearColor

 

ColorAndOpacity

The color multiplier for the button content

Public variable

bool

 

IsFocusable

Sometimes a button should only be mouse-clickable and never keyboard focusable.

Protected variable

TSharedPtr< SBu...

 

MyButton

Cached pointer to the underlying slate button owned by this UWidget

Public variable

FOnButtonClicke...

 

OnClicked

Called when the button is clicked

Public variable

FOnButtonHoverE...

 

OnHovered

Public variable

FOnButtonPresse...

 

OnPressed

Called when the button is pressed

Public variable

FOnButtonReleas...

 

OnReleased

Called when the button is released

Public variable

FOnButtonHoverE...

 

OnUnhovered

Public variable

TEnumAsByte< EB...

 

PressMethod

The type of keyboard/gamepad button press action required by the user to trigger the buttons 'Click'

Public variable

TEnumAsByte< EB...

 

TouchMethod

The type of touch action required by the user to trigger the buttons 'Click'

Public variable

FButtonStyle

 

WidgetStyle

The button style used at runtime

Constructors

Name Description

Public function

UButton

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Const

bool

 

IsPressed()

Returns true if the user is actively pressing the button.

Public function

void

 

SetBackgroundColor

(
    FLinearColor InBackgroundColor
)

Sets the color multiplier for the button background

Public function

void

 

SetClickMethod

(
    EButtonClickMethod::Type InClickMet...
)

Public function

void

 

SetColorAndOpacity

(
    FLinearColor InColorAndOpacity
)

Sets the color multiplier for the button content

Public function

void

 

SetPressMethod

(
    EButtonPressMethod::Type InPressMet...
)

Public function

void

 

SetStyle

(
    const FButtonStyle& InStyle
)

Sets the color multiplier for the button background

Public function

void

 

SetTouchMethod

(
    EButtonTouchMethod::Type InTouchMet...
)

Protected function

FReply

 

SlateHandleClicked()

Handle the actual click event from slate and forward it on

Protected function

void

 

SlateHandleHovered()

Protected function

void

 

SlateHandlePressed()

Protected function

void

 

SlateHandleReleased()

Protected function

void

 

SlateHandleUnhovered()

Overridden from UPanelWidget

Name Description

Protected function Virtual Const

UClass *

 

GetSlotClass()

UPanelWidget.

Protected function Virtual

void

 

OnSlotAdded

(
    UPanelSlot* Slot
)

Protected function Virtual

void

 

OnSlotRemoved

(
    UPanelSlot* Slot
)

Overridden from UWidget

Name Description

Protected function Virtual Const

TSharedPtr< ...

 

GetAccessibleWidget()

Gets the widget that accessibility properties should synchronize to.

Public function Virtual

const FText

 

GetPaletteCategory()

Gets the palette category of the widget

Protected function Virtual

TSharedRef< ...

 

RebuildDesignWidget

(
    TSharedRef< SWidget > Content
)

Protected function Virtual

TSharedRef< ...

 

RebuildWidget()

Function implemented by all subclasses of UWidget is called when the underlying SWidget needs to be constructed.

Public function Virtual

void

 

SynchronizeProperties()

Applies all properties to the native widget if possible.

Overridden from UVisual

Name Description

Public function Virtual

void

 

ReleaseSlateResources

(
    bool bReleaseChildren
)

Overridden from UObject

Name Description

Public function Virtual

void

 

PostLoad()

Begin UObject.

Deprecated Variables

Name Description

Public variable

USlateWidgetSty...

 

Style_DEPRECATED

The template style asset, used to seed the mutable instance of the style.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss