Download

Open combobox from code

Hi guys,
I am trying to open a UComboBoxString from code or blueprint without any input but with a command received over TCP instead! Is there any way this is possible?

thanks!

is it not possible? i thought OnOpening.Broadcast(); would work but it doesnt.
it seems kinda odd since i can change values via code but not open it

OnOpening.Broadcast(); does not cause the combobox to open, it is there to notify all registered listeners that the box was just opened. If you look at UComboBoxString’s implementation you’ll notice that it uses the Slate SComboBox widget internally. If you now inspect SComboBox and its parent classes you’ll eventually come across the lines of code where input is handled to open and close the box. This uses the public SetIsOpen method of SMenuAnchor which SComboBox (indirectly) derives from.

You should be able to figure out the rest. One last thing though. UComboBoxString::MyComboBox is protected and there’s no public getter that I can see so you may have to customize your engine a bit so you can get access to it.

I extended the Button to expose it publicly so I could click it and flip hover states with the controller, called it SimButton. A similar thing would work here. I chose to do that instead of modifying the base class.

I think that all the GUI functionality should have public control functions in at the base class instead of assuming that it will always be a mouse interaction, but it was like that in UE3 with ScaleForm. This would make it much easier to add GamePad support for UI as well as TutorialMode where you want to have scripted UI behavior, and as well networked control like this thread is asking about.

thanks for your help guys!
i actually am using a derived custom combobox, so i can access the MyComboBox->SetIsOpen(true) function. however nothing happens when i call the method… the MyComboBox->IsOpen() state also does not change

i as a programmer who only recently switched to unreal, find it kind of odd that there is no real documentation on coding in ue.