예제 #1
0
    public void Show(List <Variant> variants, string leftWord)
    {
        if (opened)
        {
            return;
        }
        opened = true;

        this.variants = variants;
        startPlace    = textBox.Controller.Lines.PlaceOf(textBox.Controller.LastSelection.caret - leftWord.Length);
        startCaret    = textBox.Controller.LastSelection.caret - leftWord.Length;
        caret         = textBox.Controller.LastSelection.caret;
        Point point = textBox.ScreenCoordsOfPlace(startPlace);

        point.Y += textBox.CharHeight;
        Point screenPoint = textBox.PointToScreen(point);

        dropDown = new AutocompleteMenu(new Handler(this));
        dropDown.SetScreenPosition(screenPoint);
        dropDown.Show(textBox, screenPoint);
        UpdateItems();

        textBox.KeyMap.AddBefore(keyMap);
        textBox.FocusedChange += OnFocusedChange;
        textBox.AfterKeyPress += OnKeyPress;
    }