When defining CreatePopup rather than CreateFilterablePopup, I would like to add a scroll function to the combo box.
In the picture above, the left side is implemented with CreateFilterablePopup, and the right side is implemented with CreatePopup.
The problem is that the combobox exceeds the UI size with CreatePopup.
I want to use only CreatePopup, not CreateFilterablePopup, CreateScrollablePopup.
The code I used is below.
Thank you, all!
In the picture above, the left side is implemented with CreateFilterablePopup, and the right side is implemented with CreatePopup.
The problem is that the combobox exceeds the UI size with CreatePopup.
I want to use only CreatePopup, not CreateFilterablePopup, CreateScrollablePopup.
The code I used is below.
C#:
public static JSONStorableStringChooser initComboBox(MVRScript unity, String name, float height, bool isLeft, System.Action<String, String>func1, System.Func<List<string>>func2)
{
var j = new JSONStorableStringChooser(name, new List<string>(), "None", name, func1 == null ? null : new JSONStorableStringChooser.SetStringCallback((String v) => func1(name, v)));
unity.RegisterStringChooser(j); j.storeType = JSONStorableParam.StoreType.Full;
UIDynamicPopup u = unity.CreatePopup(j, !isLeft);
if (func2 != null) u.popup.onOpenPopupHandlers += () => { j.choices = func2(); };
/* Scrollable ComboBox Pseudo Code Here !!!
u.popup.blahblah~.setScrollablePopup(true);
*/
LayoutElement l = u.GetComponent<LayoutElement>();
l.preferredHeight = l.minHeight = u.height = height;
return j;
}
Last edited: