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:
| Member | Kind | Use |
|---|---|---|
SetButtonText(Text) | BlueprintCallable | Sets the label at runtime (respects the ButtonText override property). |
UpdateButtonText(Text) | BlueprintImplementableEvent | Implement in your Blueprint: receive the text and push it into your TextBlock. |
UpdateButtonStyle() | BlueprintImplementableEvent | Implement to restyle when the input method changes (called on construct and on input-method change). |
ButtonText | EditAnywhere (with override checkbox) | Design-time label. |
Images/CrimsonUI/howto-button-base.pngButtonText; 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.
Images/CrimsonUI/howto-button-countdown-bp.png3. 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.
Images/CrimsonUI/howto-bound-action-button.pngSee also
- How-To: Show Confirmation Dialogs - the entry box spawns your
UCrimsonButtonBasesubclass. - How-To: Tabs - tab buttons derive from the same button base.