public void BeginEdit(string text, IIntellisenseProvider provider, EditMode mode, Color color, bool focus) { IXmlBuilder builder = null; IIntellisenseList list = null; if (focus) { switch (mode) { case EditMode.Value: builder = provider.Builder; this._cset.Builder = builder; this._editor = provider.Editor; if (this._editor != null) { this._editor.Site = this._site; } list = provider.GetExpectedValues(); break; case EditMode.Name: list = provider.GetExpectedNames(); break; } } this._schemaType = provider.GetSchemaType(); if (this._editor != null) { this._currentEditor = this._editor.Editor as Control; _parent.Controls.Add(this._currentEditor); this._editor.SchemaType = this._schemaType; this._currentEditor.KeyDown += new KeyEventHandler(editor_KeyDown); this._editor.XmlValue = text; } else { this._currentEditor = this._textEditor; this._currentEditor.Text = text; } this._currentEditor.ForeColor = color; PerformLayout(); this._currentEditor.Visible = true; if (focus) { this._currentEditor.Focus(); if (this._currentEditor == this._textEditor) { this._textEditor.SelectAll(); } // see if this node needs a dropdown. if (builder != null || (list != null && list.Count > 0)) { _cset.BeginEdit(list, this._schemaType); } } }
public void BeginEdit(IIntellisenseList list, XmlSchemaType type) { this._type = type; this._listBox.Font = this._button.Font = this._editor.Font; this._listBox.ForeColor = this._editor.ForeColor; this._list = list; // populate the list and display it under (or above) the editor. this._listBox.Items.Clear(); if (list != null) { for (int i = 0, n = list.Count; i < n; i++) { string s = list.GetValue(i); int j = this._listBox.Items.Add(s); if (s == this._editor.Text) { this._listBox.SelectedIndex = j; } } } if (!_parented) { SetParent(this.Handle, IntPtr.Zero); // popup on desktop. _parented = true; Control p = this._editor; while (p.Parent != null) { p = p.Parent; } p.Move += new EventHandler(OnWindowMoved); } PositionPopup(); this.Visible = true; this._editor.Focus(); }
public void BeginEdit(IIntellisenseList list, XmlSchemaType type) { this.type = type; this.listBox.Font = this.button.Font = this.editor.Font; this.listBox.ForeColor = this.editor.ForeColor; this.list = list; // populate the list and display it under (or above) the editor. this.listBox.Items.Clear(); if (list != null) { for (int i = 0, n = list.Count; i<n; i++) { string s = list.GetValue(i); int j = this.listBox.Items.Add(s); if (s == this.editor.Text) { this.listBox.SelectedIndex = j; } } } if (!parented) { SetParent(this.Handle, IntPtr.Zero); // popup on desktop. parented = true; Control p = this.editor; while (p.Parent != null) { p = p.Parent; } p.Move += new EventHandler(OnWindowMoved); } PositionPopup(); this.Visible = true; this.editor.Focus(); }