Setting On Hovered Events For Comboboxes?

I’m setting up my main menu and part of that involves enabling sound effects for hovering over and clicking my buttons. I’ve hit a little snag when it comes to my comboboxes, however, as there isn’t a “Create Event” option for “On Hovered” like there is for standard buttons. How can I achieve this?

tl;dr - User Widgets.

You’d need to create a separate widget that has the ComboBox (and any other associated elements). And then add those user widgets to your main panel. Since each of those ComboBoxes is a brand new widget, you can override its onMouseEnter / Leave.


This also gives you a chance to encapsulate functionality in the ComboBox itself, perhaps there are things that the main panel does not need to be cluttered with. It also makes it possible to maintain the widget throughout the game. Imagine what happens if you’re suddenly unhappy with the shade of green of your 74 ComboBoxes distributed unevenly across 6 menus. Having a widget wrapped with a user widget makes all the changes done to it propagate.

Okay, I’ve got the sound for hovering over the unopened widget set. How can I set a sound to play when mousing over the options inside?

Bumping this question.

Same as above:

  • create a widget that will represent a ComboBox entry and have it play sound onMouseEnter:

  • in the widget housing the ComboBox override onGenerate, feed generated children data from the ComboBox list:

Image from Gyazo

Doesn’t seem to be working for me. I created the text option widget exactly as in your example, and I also created the widget in the combobox’s “On Generate Widget” function as you did, with the addition of setting the widget as a variable, but I end up with an empty combobox in-game (even when I set a default value for the Text variable).

I’ve been working on my comboboxes using [these][1] [tutorials][2], and this is what I’ve added to my combobox’s Event Construct.

This does add options to the combobox, but they’re all blank and I get no sound or print strings when mousing over them.

I just tested it briefly with the ComboBox populated dynamically and it works well, too. Consider posting some screenshots, perhaps I can help you poke holes in them.

Things to double check:

  • is the variable bound to the text box in the widget representing the entry in the ComboBox - as indicated with the left-hand side arrow in my screenshot
  • the text box widget’s root has to be Self Hit Test Visible (with text Visible) or Visible (other elements’ visibility set to Hit Test Invisible - ideally).
  • is the variable exposed and fed data in the generate event
  • is the value returned in the above event

Yes, the text variable is bound to the text box, editable, and exposed and is in the text widget.

It was initially Self Hit Test Visible by default, I set it to Visible just in case. No difference.

Third part, I have no clue. The generate event is put in exactly as it was in your screenshot and that’s the only thing I did with the event. There are no outside events calling it or anything aside from it being bound in the details panel. I’ve tried calling the generate event on event construct, but I can’t figure out how to feed my array of string options into the function.

280004-combobox-2.png

And for the last part, I’m assuming you mean that the return value of the Create Widget node is plugged into the Return Node, and in that case yes it is. Again, exactly the same as the image you showed.

(It’s hard to believe that something as seemingly simple as a mouseover sound would be so dang confusing. >.< )

Sorry to hear you’re having issue with this but frankly speaking, it’s one of the more straightforward setups. The whole thing is contained in the 2 screenshots I originally posted and took minutes to put together. It would be best if you simply uploaded the images.


For example, what you’re showing in the screenshot makes little sense - you’re trying to feed an array to a function that takes a string variable, not a string array. The function input here should be an array. I’m assuming it’s the function that populates the data for the combobox.


I’ve attached a clean zipped project with the functionality you’re after, it includes generating the list from a string array (in the construct script). It’s 2 widgets (combobox and its entry), one exposed text variable, one function - onGenerate. The combobox is added to the viewport in the level blueprint.

https://drive.google.com/open?id=11sJPpmqzEDyNvoV-dkxMzJJof5OYduPi

Hope it helps.

I knew it seemed like something that should be really simple, and I know I must seem like a complete idiot, but I really am just not getting anywhere with this for whatever reason.

I opened your project, but no content showed up in the browser even though it was in the files. I also tried copying over your widget UAssets to my project file, but they wouldn’t show up there either.

This is my design panel for the text widget.

Here’s the event graph and variables.

Design panel for the combobox widget.

Combobox generate event and variables.

And I know why the array won’t plug into the variable input in the screenshot, but I’m confused as to how you seem top have gotten multiple different options out of a variable input instead of an array input (I should’ve found a better way to express my confusion with this part, so I’m sorry for that).

No worries.

  • remove the canvas from the ComboBox text widget (see my first pic), it’s not needed, we’re not moving the text around, and text widget size will be dictated by the parent here anyway.

  • the rest look fine

What we can’t see here is how you add options to the ComboBox. May I suggest, as a test, that you do not dynamically add the options from the array for now, but punch in a couple of default strings instead - just to see whether you can get them to show up.


how you seem
top have gotten multiple different
options out of a variable input
instead of an array input

Combobox keeps a list of default options:

280121-capture.png

Every time you activate the dropdown, the combobox will step through the list and create widgets on the fly based on those entries. Closing the dropdown, destroys those widgets.

This list can be, of course, constructed programmatically instead (or, in addition to):

Perhaps the issue you’re having lies elsewhere. A couple of screenshots above you are populating the ComboBox options from CampaignList - are you sure that array contains what you think it does?

Do note that you did wrap the entire ComboBox with a User Widget (to get a sound play onMouseEnter). Has this widget been given the correct options to add to the ComboBox list?

Okay, I removed the canvas panel from the text widget and when I create the combobox options manually, they do show up as expected (and with the sounds for mousing over the unopened combobox and opening it playing correctly).

The Campaign List looks right to me, but that definitely doesn’t mean much. LOL

I’m confused by that last bit. Are you asking if I wrapped the combobox in the menu it’s added to (in which it is a User Widget) or if I wrapped it in the combobox’s own widget? And I have no clue what options you would be referring to.

(After some thought, I’m thinking that I can possibly better achieve what I’m trying to do using buttons, something that I definitely know I can do. I still want to figure this out for future reference, though.)

So is it now the matter of populating the ComboBox with CampaignList array’s elements? Are both the array and the combobox that needs it in the same widget?

The array was created in the combobox widget, yes.