Exemple #1
0
        private void ShowPopupOrList()
        {
            int iMin = (_items.Length > 5) ? _lineHeight * 5 : _lineHeight * _items.Length;
            int h    = Parent.Height - Y - Height;

            if (_forcePopup || h < iMin)
            {
                new Thread(Modal).Start();
            }
            else
            {
                if (h > Core.ScreenHeight / 2)
                {
                    h = Core.ScreenHeight / 2;
                }
                if (h > (_items.Length * _lineHeight) + 3)
                {
                    h = (_items.Length * _lineHeight) + 3;
                }

                var lstDynamic = new Listbox(Name + "_lst", _font, X, Y + Height - 1, Width - 31, h, _items)
                {
                    ZebraStripe      = _bZebra,
                    ZebraStripeColor = _zebra,
                    SelectedIndex    = _selIndex
                };
                lstDynamic.DoubleTap += (sender2, e2) => CleanUp(lstDynamic);
                lstDynamic.LostFocus += sender3 => CleanUp(lstDynamic, false);
                Parent.AddChild(lstDynamic);
                Parent.ActiveChild = lstDynamic;
            }
        }
Exemple #2
0
 private void CleanUp(Listbox lst, bool updateSelection = true)
 {
     if (updateSelection || Focused)
     {
         SelectedIndex = lst.SelectedIndex;
     }
     Parent.RemoveChild(lst);
 }