void AutoCompletor(string s, ExtendedControls.ExtTextBoxAutoComplete t, SortedSet <string> set) { Tuple <Group, Group.Conditions> gc = t.Tag as Tuple <Group, Group.Conditions>; if (gc.Item1.variables != null) { foreach (var x in gc.Item1.variables) { if (x.Name.StartsWith(s, StringComparison.InvariantCultureIgnoreCase)) { string chelp = (x.Help ?? "").AppendPrePad(x.Comment, ":"); chelp = chelp.Replace("\n", " "); chelp = chelp.Truncate(0, AutoCompleteStringCropLength, ".."); set.Add(x.Name.AppendPrePad(chelp, commentmarker)); } } } }
List <string> AutoCompletor(string s, ExtendedControls.ExtTextBoxAutoComplete t) { Tuple <Group, Group.Conditions> gc = t.Tag as Tuple <Group, Group.Conditions>; List <string> ret = new List <string>(); if (gc.Item1.variables != null) { foreach (var x in gc.Item1.variables) { if (x.Name.StartsWith(s, StringComparison.InvariantCultureIgnoreCase)) { ret.Add(x.Name + (x.Comment != null ? (" " + commentmarker + " " + x.Comment) : "")); } } } return(ret); }
private void TextChangedInLeft(object sender, EventArgs e) // something changed in text field.. { ExtendedControls.ExtTextBoxAutoComplete t = sender as ExtendedControls.ExtTextBoxAutoComplete; Tuple <Group, Group.Conditions> gc = t.Tag as Tuple <Group, Group.Conditions>; if (gc.Item1.variables != null) // if variables associated { string text = t.Text; foreach (var v in gc.Item1.variables) { if (text.Equals(v.Name)) { t.SetTipDynamically(toolTip, v.Help ?? ""); if (v.DefaultCondition != null) { ExtendedControls.ExtComboBox cb = gc.Item2.cond; if (ConditionEntry.MatchTypeFromString(cb.Text, out ConditionEntry.MatchType mt)) { ConditionEntry.Classification mtc = ConditionEntry.Classify(mt); ConditionEntry.Classification defcls = ConditionEntry.Classify(v.DefaultCondition.Value); if (mtc != defcls) { System.Diagnostics.Debug.WriteLine("Select cond" + v.DefaultCondition.Value + " cur " + mt); cb.SelectedItem = ConditionEntry.MatchNames[(int)v.DefaultCondition.Value]; } } } return; } } } t.SetTipDynamically(toolTip, ""); }