Exemple #1
0
        private void UserCmb_TextChanged(object sender, EventArgs e)
        {
            if (m_busy)
            {
                return;
            }
            m_busy = true;
            if (m_idx == null)
            {
                m_idx = new Indexer();
                var tLst = new List <string>();
                foreach (var i in m_users)
                {
                    tLst.Add(i.zUserFb);
                }
                m_idx.init(tLst);
                m_bs = new BindingSource();
                userCmb.DataSource = m_bs;
            }
            var oldTxt = userCmb.Text;
            var res    = m_idx.Find(userCmb.Text);

            if (res != null)
            {
                m_bs.DataSource = res.items;
                //userCmb.DataSource = res.items;
                userCmb.DroppedDown     = true;
                Cursor.Current          = Cursors.Default;
                userCmb.Text            = oldTxt;
                userCmb.SelectionStart  = oldTxt.Length;
                userCmb.SelectionLength = 0;

                if (res.items.Length == 1)
                {
                    userCmb.Text        = res.items[0];
                    userCmb.DroppedDown = false;
                }
            }
            m_busy = false;
            //if (m_maps == null) {
            //    m_maps = new Dictionary<string, string>();

            //    foreach (var i in userCmb.Items)
            //    {
            //        string val = i.ToString();
            //        string key = genKey(val);
            //        m_col.Add(val);
            //        m_col.Add(key);
            //        try
            //        {
            //            m_maps.Add(key, val);
            //        }
            //        catch { }
            //    }
            //userCmb.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            //userCmb.AutoCompleteSource = AutoCompleteSource.CustomSource;
            //userCmb.AutoCompleteCustomSource = m_col;
            //}
        }
Exemple #2
0
        private void UserCmb_TextChanged(object sender, EventArgs e)
        {
            if (m_busy)
            {
                return;
            }
            m_busy = true;
            if (m_idx == null)
            {
                m_idx = new Indexer();
                var tLst = new List <string>();
                foreach (var i in m_users)
                {
                    tLst.Add(i.zUserFb);
                }
                m_idx.init(tLst);
                m_bs = new BindingSource();
                userCmb.DataSource = m_bs;
            }
            var oldTxt = userCmb.Text;
            var res    = m_idx.Find(userCmb.Text);

            if (res != null)
            {
                m_bs.DataSource = res.items;
                //userCmb.DataSource = res.items;
                userCmb.DroppedDown     = true;
                Cursor.Current          = Cursors.Default;
                userCmb.Text            = oldTxt;
                userCmb.SelectionStart  = oldTxt.Length;
                userCmb.SelectionLength = 0;

                if (res.items.Length == 1)
                {
                    userCmb.Text        = res.items[0];
                    userCmb.DroppedDown = false;
                }
            }
            m_busy = false;
        }