UDreamDropdown
A dropdown whose hierarchy is code, not an asset.
Inherits from UDreamUIControl.
Declared in Public/Controls/DreamDropdown.h.
A dropdown whose hierarchy is code, not an asset.
The largest of the preset Blueprints -- sixteen widgets -- reduced to what UUIDropdown actually reads: a face with a caption, a list root that Show() positions and animates, and inside it a content column holding one templated row. The behaviour duplicates that row per option, so the template is authored once, inactive, and never drawn itself.
The row carries the toggle arrangement the library keeps arriving at: hover tints the row's own face, the selection mark is a separate visual, because one visual cannot hold two transitions.
Options are plain texts here rather than the behaviour's text+brush pairs: the common case, and the control's job is to be the common case. A consumer needing per-option icons talks to DropdownBehaviour directly.
Where there is no tween manager to fade the list -- a world with no game instance, which is the designer's preview and a headless test -- it opens and closes at once, at its end opacity, rather than waiting on a fade that will never run.
Properties
| Name | Type | Category | In the details panel | From Blueprint | Description |
|---|---|---|---|---|---|
Style | FDreamDropdownStyle | Dropdown | yes | GetStyle / SetStyle | This instance's own look. The project sheet wins while StyleSource says so AND a sheet actually exists; with no sheet in the project this IS the look in effect -- which is why it stays editable instead of being gated on the enum: the old edit condition greyed the exact values that were driving the control. |
Options | TArray<FText> | Dropdown | yes | GetOptions / SetOptions | BlueprintReadOnly rather than a BlueprintSetter pair, and for the reason UDreamDialog::Buttons is: the options are what the open list is BUILT from, so a Blueprint writing this array in place changed the data and left the list showing the old copy. SetOptions is the way in. The designer and .dui still author it directly, where PostEditChangeProperty re-pushes. |
SelectedIndex | int32 | Dropdown | yes | GetSelectedIndex / SetSelectedIndex | Authored selection in; mirror of the behaviour's out. -1 is none. |
MaxVisibleItems | int32 | Dropdown | yes | GetMaxVisibleItems / SetMaxVisibleItems | How many rows the open list shows at most. The list is always exactly as tall as its visible rows -- rows-times-row-height, no more -- and past this many the rest scroll: the cap is a count because that is how a designer thinks about a dropdown, not in pixels. |
OptionIcons | TArray<TObjectPtr<UObject> > | Dropdown | yes | SetOptionIcons | A picture per option, index-matched to Options -- the same parallel-array idiom TabLabels and TabEnabled use, and for the same reason: a struct per option would make the common case (no icons at all) cost an array literal the language cannot write. |
bHasDownArrow | bool | Dropdown | yes | GetHasDownArrow / SetHasDownArrow | Whether the face draws its own arrow glyph -- UMG's HasDownArrow. Off is for a face that says "open me" some other way (an icon of its own, a border). |
bTabCommitsHighlightedRow | bool | Dropdown | yes | GetTabCommitsHighlightedRow / SetTabCommitsHighlightedRow | Tab or Shift+Tab in the open list chooses the row the player is on, then the list closes and the Tab moves on past the dropdown -- what an HTML select does. Off, Tab only closes the list and chooses nothing. Tab never walks the rows: the arrow keys and the pad do that. |
ItemTemplateClass | TSubclassOf<UDreamUserWidget> | Dropdown | yes | GetItemTemplateClass / SetItemTemplateClass | An option row's CONTENT, authored elsewhere: one instance of this class is created inside every item widget, filling it, and the built-in label steps aside. The row's face, its check mark, its hover and its selection stay the control's, so a template only has to draw an option. |
FaceNode | TObjectPtr<UDreamWidget> | Dropdown | - | read only | |
CaptionNode | TObjectPtr<UDreamWidget> | Dropdown | - | read only | |
ArrowNode | TObjectPtr<UDreamWidget> | Dropdown | - | read only | |
ListNode | TObjectPtr<UDreamWidget> | Dropdown | - | read only | |
ItemTemplateNode | TObjectPtr<UDreamWidget> | Dropdown | - | read only | |
DropdownBehaviour | TObjectPtr<UUIDropdown> | Dropdown | - | read only |
Functions
| Function | Kind | Description |
|---|---|---|
void AddOption(FText InOption) | callable | The option list, one call at a time -- UMG's combo box API, which is what a screen building its options from game data actually uses. |
void ClearOptions() | callable | The options and their icons, both. The selection is ClearSelection's business, not this one's. |
void ClearSelection() | callable | Selects nothing at all -- index -1, which is what the control already spells "none". |
int32 FindOptionIndex(FText InOption) | pure | Compared by MEANING (FText::EqualTo), so a localized option matches across cultures. -1 for none. |
bool GetHasDownArrow() | pure | Get Has Down Arrow |
TSubclassOf<UDreamUserWidget> GetItemTemplateClass() | pure | Get Item Template Class |
int32 GetMaxVisibleItems() | pure | Get Max Visible Items |
FText GetOptionAtIndex(int32 InIndex) | pure | Empty text for an index nobody offers, rather than a read off the end. |
int32 GetOptionCount() | pure | Get Option Count |
TArray<FText> GetOptions() | pure | Get Options |
int32 GetSelectedIndex() | pure | Get Selected Index |
FText GetSelectedOption() | pure | The selected option's text, or empty while nothing is selected. |
FDreamDropdownStyle GetStyle() | pure | Get Style |
bool GetTabCommitsHighlightedRow() | pure | Get Tab Commits Highlighted Row |
bool IsOpen() | pure | Whether the list is up. Mirrored from the behaviour's own visibility seam rather than kept by whoever opened it, so a list closed by a click elsewhere is not still "open" here. |
void RefreshOptions() | callable | Rebuild the rows from the current options. For a caller who edited the array in place. |
bool RemoveOption(FText InOption) | callable | False when no option matched, as UMG's returns. Takes the matching icon with it. |
void SetHasDownArrow(bool bInHasDownArrow) | callable | Set Has Down Arrow |
void SetItemTemplateClass(TSubclassOf<UDreamUserWidget> InItemTemplateClass) | callable | Rebuilds the rows: what a row IS comes from this class, so a bare write would change nothing. |
void SetMaxVisibleItems(int32 InMaxVisibleItems) | callable | How many rows the open list shows at most, re-pushed at once. |
void SetOptionIcons(TArray<UObject*> InIcons) | callable | Replace the per-option pictures and re-push the list, so an open one changes under the pointer. |
void SetOptions(TArray<FText> InOptions) | callable | Replace the options: an open list is rebuilt and re-placed at once, a closed one when it next opens. |
void SetSelectedIndex(int32 InIndex) | callable | Set Selected Index |
void SetSelectedOption(FText InOption) | callable | Selects the option with that text. An option nobody offers changes nothing. |
void SetStyle(FDreamDropdownStyle InStyle) | callable | This instance's whole look, replaced and pushed. See UDreamButton::SetStyle for the caveat. |
void SetTabCommitsHighlightedRow(bool bInTabCommitsHighlightedRow) | callable | See bTabCommitsHighlightedRow. Pushed to the behaviour at once, so an open list answers the next Tab by it. |
Events
| Event | Signature | Description |
|---|---|---|
OnSelectionChanged | void DreamDropdownChangedEvent__DelegateSignature(int32 SelectedIndex) | Re-broadcast from the behaviour, so a consumer binds to the control, not to a part of it. |
OnOpening | void DreamDropdownSimpleEvent__DelegateSignature() | The list is opening -- UMG's OnOpening, and the moment to refresh the options from. |
OnClosed | void DreamDropdownSimpleEvent__DelegateSignature() | The list closed, whether by a choice or by a click elsewhere. |
OnValueChangedBP | void DreamDropdownChangedEvent__DelegateSignature(int32 SelectedIndex) | The <-> convention: two-way bindings synthesize their reverse route against this exact name, so a value control carries it alongside its spoken events. Fires with them. |
OnItemGenerated | void DreamDropdownItemEvent__DelegateSignature(int32 ItemIndex, UDreamWidget* Item) | One per option row, as the list is built. The hook for a consumer whose options are richer than a word but who would rather not author a whole class: everything under the row is reachable from here by display name. The dropdown's counterpart of the list's OnRowGenerated. |
Compared with UMG
Every Blueprint-facing member of the UMG class, and where it went. adopt: same name, same meaning. map: here under another name or on another type. reject: deliberately absent, with the reason.
| UMG | Member | Status | Here | Note |
|---|---|---|---|---|
UComboBoxString | DefaultOptions | map | Options | One array, not two. UMG keeps DefaultOptions beside a runtime list because its combo box rebuilds from the Slate widget's own copy; here the rows are built from Options on every push, so the authored array IS the live one. |
UComboBoxString | SelectedOption | map | SelectedIndex | The index is the authored truth and the option text follows from it (GetSelectedOption / SetSelectedOption). Two authored spellings of one selection is how an array edit leaves them disagreeing. |
UComboBoxString | WidgetStyle | map | Style | FDreamDropdownStyle: the face's five state colours and brush, the list's background, the rows, the check mark and the caption. |
UComboBoxString | ItemStyle | map | FDreamDropdownStyle::ItemBrush | A row's look is part of the dropdown's own style rather than a separate table-row style: ItemBrush, ItemHeight, ItemHovered, ItemFocused, ItemDisabled and CheckColor beside it. |
UComboBoxString | ScrollBarStyle | reject | There is no bar to style. This dropdown's open list is exactly MaxVisibleItems tall and scrolls by wheel and drag with no bar drawn -- a list capped at a row count is always the size it looks, which is what makes the bar unnecessary rather than missing. The family's bar style is FDreamScrollBarStyle and its control is Native.ScrollBar; a list that wants one is a Native.ScrollBox, not a combo box. | |
UComboBoxString | ContentPadding | map | FDreamDropdownStyle::ContentPadding | In the style, and its default is what the control has always arranged down to the number (ten left, twenty-four right to clear the arrow). Stating it makes a wider face, or a face with no arrow, something a project sheet can answer. |
UComboBoxString | MaxListHeight | map | MaxVisibleItems | A row COUNT rather than a pixel height, because that is how a designer thinks about a dropdown; the open list is exactly count-times-ItemHeight tall and the rest scroll. |
UComboBoxString | HasDownArrow | map | bHasDownArrow | Named with this codebase's bool prefix. |
UComboBoxString | EnableGamepadNavigationMode | reject | A switch between two behaviours, of which only one exists here -- and it is the one the flag turns ON. An open list's rows are ordinary selectables: a direction moves focus and commits nothing until the row is activated, which is exactly UMG's gamepad navigation mode. The OFF state, where a direction on the CLOSED control changes the value without opening it, has no counterpart and should not gain one: a closed control that eats left and right is the trap UUISlider::RequiresControllerLock exists to keep a row of controls out of. | |
UComboBoxString | Font | map | FDreamDropdownStyle::FontSize | A size, not an FSlateFontInfo: the typeface is the text visual's own (UDreamText), and what a dropdown's style decides is how big its caption and rows are. |
UComboBoxString | ForegroundColor | map | FDreamDropdownStyle::TextColor | The caption's and the rows' colour. FDreamUIStateFaces beside it carries a per-state foreground for a face that wants its caption to change with the pointer. |
UComboBoxString | bIsFocusable | map | UDreamWidget::bIsFocusable | Every widget here carries it. |
UComboBoxString | OnGenerateWidgetEvent | map | ItemTemplateClass | A CLASS rather than a per-row delegate, with OnItemGenerated fired for each row to fill it. Same bargain as UDreamListViewBase::RowTemplateClass: a class is something .dui and the designer can name, and a delegate is not. |
UComboBoxString | OnSelectionChanged | map | OnSelectionChanged | Carries the index. UMG's second argument, ESelectInfo, has no counterpart: the behaviour raises one value-changed seam whatever moved the value, so 'who changed it' is not a question this control can answer honestly. |
UComboBoxString | OnOpening | adopt | OnOpening | Fired from the behaviour's Show, before the rows are placed -- so options written from a handler are the ones the player sees. OnClosed is the pair UMG has no name for. |
UComboBoxString | AddOption | adopt | AddOption | FText rather than FString: an option is something a player reads, and this framework carries FText all the way. |
UComboBoxString | RemoveOption | adopt | RemoveOption | Takes the index-matched icon with it. |
UComboBoxString | FindOptionIndex | adopt | FindOptionIndex | Compares by meaning (FText::EqualTo), so a localized option matches across cultures. |
UComboBoxString | GetOptionAtIndex | adopt | GetOptionAtIndex | Empty text for an index nobody offers. |
UComboBoxString | ClearOptions | adopt | ClearOptions | Options and icons; the selection is ClearSelection's business, as in UMG. |
UComboBoxString | ClearSelection | adopt | ClearSelection | Index -1, which is what this control already spells 'none'. |
UComboBoxString | RefreshOptions | adopt | RefreshOptions | For a caller who edited the array in place. |
UComboBoxString | SetSelectedOption | adopt | SetSelectedOption | An option nobody offers changes nothing, rather than clearing the selection. |
UComboBoxString | SetSelectedIndex | adopt | SetSelectedIndex | |
UComboBoxString | GetSelectedOption | adopt | GetSelectedOption | |
UComboBoxString | GetSelectedIndex | adopt | GetSelectedIndex | |
UComboBoxString | GetOptionCount | adopt | GetOptionCount | |
UComboBoxString | IsOpen | adopt | IsOpen | Mirrored from the behaviour's visibility seam, so a list closed by a click elsewhere is not still open here. |
UComboBoxString | SetStyle | adopt | SetStyle | Not a UFUNCTION on UComboBoxString (its Setter meta names it); added here so a look can be replaced at runtime. |