Show combobox without its active selection

@Roy_Wierer.Seda145 would you happen to know the answer to this? :slight_smile:


I have a settings widget for a menu. It contains two text fields and a combobox (besides borders, size boxes, spacers, etc.). The image below shows how I want it to look:

I achieve this by explicitly clearing its selection after it has been changed in Blueprint, like so:

And this works quite well. I want to manually control the text field for two reasons: 1) I think it looks better and its more customizable, 2) I had conflicts with OnSelectionChanged being called twice when setting its text (loading active preset from GameUserSettings and settings the text, which triggered this callback and set it again).

But now, as can be seen in the first image, even though “Ultra” should be selected actively when opening the combobox (different background color) it does not show.
I have tried calling SetSelectedOption() on the combobox inside OnOpening() Blueprint event, but that has zero visual effect.

Is there a good way to solve this? Ie. knowing which option is “active” and marking it as such when opening the combobox, but also NOT showing the active text when the combobox is closed?

The blueprint code you show on that image always clears the combobox once a valid value is set, so it is expected not to show Ultra in the box.

Is there no way to get an acceptable style with the combobox alone, without clearing the value?

You could play a bit with a SizeBox widget around it, see if you can cut off the text of the ComboBox by forcing the XY size to 30px30px?

*Edit
here is a clever one. If my suggestion of cutting the text with a SizeBox does not look pixel perfect, you can always show a non interactable image on top of that:

How to disable text on a combobox.

so you get something like:

Sizebox (force 30 px X Y)
-- Overlay (full area of parent):
---- Image (arrow icon, full area of parent, not hit testable)
---- ComboBox (hit testable, full area of parent, set to visible but is not actually visible under the Image.)
1 Like

I use a static bool or enum to keep track of progress, so that my system knows when it is being altered by the system or by a user clicking UI. That way I can set things up without triggering events (that re run you talk about).

**realizing BP does not use static variables, you could create a “SetValue” method into your setting widget and pass a value and a bool into it, where the bool tells the widget if it is a setup process or a user interaction. Only broadcast “value changed” events on user interaction, or broadcast it anyway along with the bool so that other processes know it is a setup interaction, so it does not retrigger informing the GameUserSettings about a value change.

1 Like

Hi, thank you for the help - I finally managed to get back to it!

Wrapping the ComboBox inside a SizeBox seems by far the best solution, for (at least) three reasons:

  1. Directional input (such as arrow keys) is captured when the box is opened, quite a convenience feature but still nice to have.
  2. When I open the ComboBox the active choice is highlighted.
  3. I don’t have to mess with moving the text outside combobox dropdown button, so I can keep the dropdown button the square size that I like (see initial screenshot).

Such a simple solution that solves all my problems. (And perhaps the next fortunate soul as well).

I also tried resizing the canvas, and it doesn’t seem like an image overlay is needed.

Thank you again, and happy new year!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.