public void ShowToolTip(AutocompleteItem autocompleteItem, Control control = null) { string title = autocompleteItem.ToolTipTitle; string text = autocompleteItem.ToolTipText; if (control == null) { control = this; } if (string.IsNullOrEmpty(title)) { toolTip.ToolTipTitle = null; toolTip.SetToolTip(control, null); return; } if (string.IsNullOrEmpty(text)) { toolTip.ToolTipTitle = null; toolTip.Show(title, control, Width + 3, 0, ToolTipDuration); } else { toolTip.ToolTipTitle = title; toolTip.Show(text, control, Width + 3, 0, ToolTipDuration); } }
private void ApplyAutocomplete(Control control, AutocompleteItem item, Range fragment) { string newText = item.GetTextForReplace(); //replace text of fragment fragment.Text = newText; control.Focus(); }
private void ApplyAutocomplete(AutocompleteItem item, Range fragment) { string newText = item.GetTextForReplace(); //replace text of fragment fragment.Text = newText; fragment.TargetWrapper.TargetControl.Focus(); }
internal virtual void OnSelecting() { if (SelectedItemIndex < 0 || SelectedItemIndex >= VisibleItems.Count) { return; } AutocompleteItem item = VisibleItems[SelectedItemIndex]; var args = new SelectingEventArgs { Item = item, SelectedIndex = SelectedItemIndex }; OnSelecting(args); if (args.Cancel) { SelectedItemIndex = args.SelectedIndex; (Host.ListView as Control).Invalidate(true); return; } if (!args.Handled) { Range fragment = Fragment; if (item is IAutoCompleteMenuItemCustomReplace customReplace) { fragment = new Range(TargetControlWrapper); fragment.Start = TargetControlWrapper.SelectionStart + TargetControlWrapper.SelectionLength - customReplace.ReplaceLength; fragment.End = fragment.Start + customReplace.ReplaceLength; } ApplyAutocomplete(item, fragment); } Close(); // var args2 = new SelectedEventArgs { Item = item, Control = TargetControlWrapper.TargetControl }; item.OnSelected(args2); OnSelected(args2); }
public void AddItem(AutocompleteItem item) { if (sourceItems == null) { sourceItems = new List <AutocompleteItem>(); } if (sourceItems is IList) { (sourceItems as IList).Add(item); } else { throw new Exception("Current autocomplete items does not support adding"); } }
public void ShowToolTip(AutocompleteItem autocompleteItem, Control control = null) { string title = autocompleteItem.ToolTipTitle; string text = autocompleteItem.ToolTipText; if (control == null) { control = this; } if (string.IsNullOrEmpty(title)) { toolTip.ToolTipTitle = null; toolTip.SetToolTip(control, null); return; } ScintillaControl = (Scintilla)targetControl; TextAreaPoint = new Point(ScintillaControl.PointXFromPosition(ScintillaControl.CurrentPosition), ScintillaControl.PointYFromPosition(ScintillaControl.CurrentPosition)); if (string.IsNullOrEmpty(text)) { toolTip.ToolTipTitle = null; if (control == this) { toolTip.Show(title, control, Width + 3, 0, ToolTipDuration); } else { toolTip.Show(title, control, TextAreaPoint.X + Width + 9, TextAreaPoint.Y + 19, ToolTipDuration); } } else { toolTip.ToolTipTitle = title; if (control == this) { toolTip.Show(text, control, Width + 3, 0, ToolTipDuration); } else { toolTip.Show(text, control, TextAreaPoint.X + Width + 9, TextAreaPoint.Y + 19, ToolTipDuration); } } }
internal virtual void OnSelecting() { if (SelectedItemIndex < 0 || SelectedItemIndex >= VisibleItems.Count) { return; } AutocompleteItem item = VisibleItems[SelectedItemIndex]; var args = new SelectingEventArgs { Item = item, SelectedIndex = SelectedItemIndex }; OnSelecting(args); if (args.Cancel) { SelectedItemIndex = args.SelectedIndex; (Host.ListView as Control).Invalidate(true); return; } if (!args.Handled) { Range fragment = Fragment; ApplyAutocomplete(TargetControl, item, fragment); } Close(); // var args2 = new SelectedEventArgs { Item = item, Control = TargetControl }; item.OnSelected(args2); OnSelected(args2); }
public void SetToolTip(AutocompleteItem autocompleteItem) { string title = VisibleItems[SelectedItemIndex].ToolTipTitle; string text = VisibleItems[SelectedItemIndex].ToolTipText; if (string.IsNullOrEmpty(title)) { toolTip.ToolTipTitle = null; toolTip.SetToolTip(this, null); return; } if (string.IsNullOrEmpty(text)) { toolTip.ToolTipTitle = null; toolTip.Show(title, this, Width + 3, 0, 3000); } else { toolTip.ToolTipTitle = title; toolTip.Show(text, this, Width + 3, 0, 3000); } }
private void ApplyAutocomplete(AutocompleteItem item, Range fragment) { var newText = item.GetTextForReplace(); //replace text of fragment var expressionTextBox = (TargetControlWrapper.TargetControl as ExpressionTextBox); var scintillaEditor = (TargetControlWrapper.TargetControl as ScintillaCodeEditorControl); var isExponent = false; if (expressionTextBox != null) { isExponent = expressionTextBox.ExponentMode; } else if (scintillaEditor != null) { isExponent = scintillaEditor.ExponentMode; } fragment.Text = isExponent ? SpecialSymbols.AsciiToSuperscript(newText) : newText; fragment.TargetWrapper.TargetControl.Focus(); }
public void ShowToolTip(AutocompleteItem autocompleteItem, Control control = null) { }
public void AddItem(AutocompleteItem item) { if (sourceItems == null) sourceItems = new List<AutocompleteItem>(); if (sourceItems is IList) (sourceItems as IList).Add(item); else throw new Exception("Current autocomplete items does not support adding"); }
public void ShowToolTip(AutocompleteItem autocompleteItem, Control control = null) { string title = autocompleteItem.ToolTipTitle; string text = autocompleteItem.ToolTipText; if (control == null) control = this; if (string.IsNullOrEmpty(title)) { toolTip.ToolTipTitle = null; toolTip.SetToolTip(control, null); return; } if (string.IsNullOrEmpty(text)) { toolTip.ToolTipTitle = null; toolTip.Show(title, control, Width + 3, 0, ToolTipDuration); } else { toolTip.ToolTipTitle = title; toolTip.Show(text, control, Width + 3, 0, ToolTipDuration); } }
// A function that returns an autoCompleteMenuItem private static AutocompleteItem CreateOne(string text, string menuText, string tooltipText, string tooltipTitle, int imageIndex) { AutocompleteItem tempItm = new AutocompleteItem(); tempItm.Text = text; tempItm.MenuText = menuText; tempItm.ToolTipText = tooltipText; tempItm.ToolTipTitle = tooltipTitle; tempItm.ImageIndex = imageIndex; return tempItm; }