How-To: Buttons & Action Glyphs

Goal: build your project's button base, a destructive-action countdown button, and prompts whose key glyph follows the player's current input device.

1. One button base for the whole project

Subclass Crimson Button Base (UCrimsonButtonBase, a UCommonButtonBase) once, style it, and derive every other button from it. The base adds text plumbing on top of CommonUI's button:

MemberKindUse
SetButtonText(Text)BlueprintCallableSets the label at runtime (respects the ButtonText override property).
UpdateButtonText(Text)BlueprintImplementableEventImplement in your Blueprint: receive the text and push it into your TextBlock.
UpdateButtonStyle()BlueprintImplementableEventImplement to restyle when the input method changes (called on construct and on input-method change).
ButtonTextEditAnywhere (with override checkbox)Design-time label.
Screenshot pendingImages/CrimsonUI/howto-button-base.png
WBP_ButtonBase (parent: Crimson Button Base): Designer has a CommonTextBlock label; Graph implements Update Button Text (Set Text on the label) and Update Button Style.
Verify
Dropping WBP_ButtonBase into any screen shows the label from ButtonText; calling Set Button Text updates it.

2. Countdown confirm for destructive actions

StartActivationCountdown(Delay) (BlueprintCallable) disables the button for Delay seconds - use it on 'Delete character'-style confirms so the player cannot double-click through. The dialog system drives this automatically from FCrimsonConfirmationDialogAction::ActivationDelay.

Screenshot pendingImages/CrimsonUI/howto-button-countdown-bp.png
On Construct of the destructive confirm button -> Start Activation Countdown (Delay = 3.0). The button re-enables itself when the countdown ends.

3. Buttons that show their bound key

Crimson Bound Action Button (UCrimsonBoundActionButton) is a UCommonBoundActionButton that swaps its style class per input method - set KeyboardStyle, GamepadStyle, and TouchStyle in defaults and CommonUI fills the key glyph from the bound action. Use it for the action bar CommonUI renders for activatable widgets.

Crimson Action Widget (UCrimsonActionWidget) is the lighter option when you only need a key icon, not a button: it is a UCommonActionWidget whose GetIconForKey(Key) (BlueprintCallable) resolves icons through the Enhanced Input subsystem.

Screenshot pendingImages/CrimsonUI/howto-bound-action-button.png
WBP_BoundActionButton Class Defaults: Keyboard Style / Gamepad Style / Touch Style set to three CommonButtonStyle assets. PIE with a gamepad shows the gamepad style + face-button glyph.
Verify
Switching input device in PIE (press a gamepad button vs move the mouse) swaps the button style and glyph live.

See also

  • How-To: Show Confirmation Dialogs - the entry box spawns your UCrimsonButtonBase subclass.
  • How-To: Tabs - tab buttons derive from the same button base.