x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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?

Product Version: UE 4.21
Tags:
more ▼

asked Jun 07 '19 at 04:01 AM in Blueprint Scripting

avatar image

Arro-Wing
10 3 2 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Jun 07 '19 at 07:05 AM

avatar image

Everynone
14.6k 76 25 61

avatar image Arro-Wing Jun 08 '19 at 12:55 AM

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?

avatar image Arro-Wing 6 days ago

Bumping this question.

avatar image Everynone 6 days ago

Same as above:

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

alt text

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

alt text

Image from Gyazo

textforcombobox.png (136.0 kB)
generate.png (53.4 kB)
avatar image Arro-Wing 5 days ago

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 tutorials, and this is what I've added to my combobox's Event Construct.

alt text

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

combobox-1.png (100.6 kB)
avatar image Everynone 5 days ago

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

avatar image Arro-Wing 2 days ago

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.

alt text

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. >.< )

combobox-2.png (29.3 kB)
avatar image Everynone 2 days ago

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.

avatar image Arro-Wing yesterday

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.

alt text

This is my design panel for the text widget.

alt text

Here's the event graph and variables.

alt text

Design panel for the combobox widget.

alt text

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).

combobox-3.png (115.4 kB)
combobox-4.png (155.4 kB)
combobox-5.png (142.1 kB)
combobox-6.png (144.0 kB)
avatar image Everynone yesterday

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:

alt text

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):

alt text

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?

capture.png (39.3 kB)
cap2.png (90.2 kB)
avatar image Arro-Wing 11 hours ago

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).

alt text

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.)

combobox-7.png (101.8 kB)
avatar image Everynone 4 hours ago

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?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question