diff --git a/Source/Editor/CustomEditors/Editors/CultureInfoEditor.cs b/Source/Editor/CustomEditors/Editors/CultureInfoEditor.cs index 271079ddd..37d0161ff 100644 --- a/Source/Editor/CustomEditors/Editors/CultureInfoEditor.cs +++ b/Source/Editor/CustomEditors/Editors/CultureInfoEditor.cs @@ -27,7 +27,7 @@ namespace FlaxEditor.CustomEditors.Editors public override void Initialize(LayoutElementsContainer layout) { _label = layout.ClickableLabel(GetName(Culture)).CustomControl; - _label.RightClick += ShowPicker; + _label.RightClick += () => CreatePicker(Culture, OnValueChanged).Show(_label, new Float2(0, _label.Height)); var button = new Button { Width = 16.0f, @@ -36,7 +36,7 @@ namespace FlaxEditor.CustomEditors.Editors Parent = _label, }; button.SetAnchorPreset(AnchorPresets.MiddleRight, false, true); - button.Clicked += ShowPicker; + button.ButtonClicked += b => CreatePicker(Culture, OnValueChanged).Show(b, new Float2(0, b.Height)); } /// @@ -74,6 +74,11 @@ namespace FlaxEditor.CustomEditors.Editors } } + private void OnValueChanged(CultureInfo value) + { + Culture = value; + } + private class CultureInfoComparer : IComparer { public int Compare(CultureInfo a, CultureInfo b) @@ -82,12 +87,6 @@ namespace FlaxEditor.CustomEditors.Editors } } - private void ShowPicker() - { - var menu = CreatePicker(Culture, value => { Culture = value; }); - menu.Show(_label, new Float2(0, _label.Height)); - } - internal static ContextMenuBase CreatePicker(CultureInfo value, Action changed) { var menu = Utilities.Utils.CreateSearchPopup(out var searchBox, out var tree);