Пример #1
0
        void OnTextFieldValueChange(ChangeEvent <string> evt)
        {
            value = evt.newValue;

            evt.StopImmediatePropagation();
            evt.PreventDefault();
        }
Пример #2
0
        void OnPopupFieldValueChange(ChangeEvent <string> evt)
        {
            // There's a bug in UIE that makes the PopupField send a ChangeEvent<string> even
            // if you called SetValueWithoutNotify(). It's the PopupTextElement.text that
            // sends it. Hence, this check.
            if (evt.leafTarget != optionsPopup)
            {
                evt.StopImmediatePropagation();
                evt.PreventDefault();
                return;
            }

            value = evt.newValue;

            evt.StopImmediatePropagation();
            evt.PreventDefault();
        }
Пример #3
0
        void CountChanged(ChangeEvent <int> evt)
        {
            evt.StopImmediatePropagation();
            evt.PreventDefault();
            var count = evt.newValue;

            if (count < 0)
            {
                m_Size.SetValueWithoutNotify(0);
                count = 0;
            }

            var iList = GetValue();

            if (null == iList)
            {
                return;
            }

            var constructContext = GetAttribute <CreateElementOnAddAttribute>();

            switch (iList)
            {
            case TElement[] array:
                var         newArray = new TElement[count];
                for (var i = 0; i < Math.Min(array.Length, count); ++i)
                {
                    newArray[i] = array[i];
                }

                for (var i = array.Length; i < newArray.Length; ++i)
                {
                    newArray[i] = CreateInstance(constructContext);
                }

                Root.SetValue(Path, newArray);
                break;

            case List <TElement> list:
                while (list.Count > count)
                {
                    list.RemoveAt(list.Count - 1);
                }

                while (list.Count < count)
                {
                    list.Add(CreateInstance(constructContext));
                }

                break;
            }

            Root.NotifyChanged(Path);
            Reload();
        }
 void OnObjectValueChange(ChangeEvent <Object> evt)
 {
     value = evt.newValue;
     evt.StopImmediatePropagation();
     evt.PreventDefault();
 }