Пример #1
0
        void tmrInterval_Tick(object sender, EventArgs e)
        {
            tmrInterval.Stop();

            SyntaxBoxControl syn = (tabDocs.SelectedTab.Controls[0] as SyntaxBoxControl);

            if (syn == null)
            {
                return;
            }

            syn.AutoListVisible = false;

            bool matches = false;

            syn.AutoListClear();

            Word w = syn.Document.GetWordFromPos(syn.Caret.Position);

            if (w == null)
            {
                return;
            }

            string txt = w.Text, word = "";

            if (!String.IsNullOrEmpty(txt) && txt.Length > 2)
            {
                syn.AutoListBeginLoad();

                word = txt.Substring(0, 3);
                PatternCollection pc = (syntaxDefinition.SpanDefinitions[0].LookupTable[word] as PatternCollection);
                if (pc == null)
                {
                    syn.AutoListEndLoad();
                    return;
                }
                foreach (Pattern p in pc)
                {
                    if (p.StringPattern.Length >= txt.Length && p.StringPattern.Substring(0, txt.Length) == txt)
                    {
                        syn.AutoListAdd(p.StringPattern, 0);
                        matches = true;
                    }
                }

                syn.AutoListEndLoad();
                if (matches)
                {
                    syn.AutoListVisible = true;
                    syn.InfoTipVisible  = false;
                }
            }
            else if (txt.Trim() == "")
            {
                syn.InfoTipVisible = false;
            }
        }