Esempio n. 1
0
        //Hover tips
        private void editor_DwellStart(object sender, DwellEventArgs e)
        {
            if (!editor.WordChars.Contains("-"))
            {
                editor.WordChars += "?-+=></*.";
            }

            var pos       = e.Position;
            var wordStart = editor.WordStartPosition(pos, false);
            var wordEnd   = editor.WordEndPosition(pos, false);
            var word      = editor.GetTextRange(wordStart, wordEnd - wordStart).Trim().TrimStart('(');

            string tip = "";

            if (!string.IsNullOrEmpty(word) && !string.IsNullOrEmpty(tip = Helptips.GetFor(word)))
            {
                editor.CallTipShow(e.Position, tip);
            }
        }
Esempio n. 2
0
        private void showHelptipMenu_Click(object sender, EventArgs e)
        {
            var startPos = editor.CurrentPosition - 1;
            var depth    = 0;

            for (var i = startPos; i >= 0; i--)
            {
                if (editor.Text[i] == '(')
                {
                    if (depth != 0)
                    {
                        depth -= 1;
                    }
                    else
                    {
                        if (!editor.WordChars.Contains("-"))
                        {
                            editor.WordChars += "?-+=></*.";
                        }

                        var    word = editor.GetWordFromPosition(i + 1);
                        string tip  = "";
                        if (!string.IsNullOrEmpty(word) && !string.IsNullOrEmpty(tip = Helptips.GetFor(word)))
                        {
                            editor.CallTipShow(editor.CurrentPosition, tip);
                        }

                        return;
                    }
                }
                else if (editor.Text[i] == ')')
                {
                    depth += 1;
                }
            }
        }