protected void ClearList(Gtk.ComboBox clrComboBox) { int IterCount = 0; Gtk.TreeIter listIter; clrComboBox.Model.GetIterFirst(out listIter); do { IterCount++; } while(clrComboBox.Model.IterNext(ref listIter)); for(int i=0; i<IterCount; i++) clrComboBox.RemoveText(0); }
/// <summary> /// Clears the given Gtk.ComboBoxEntry values. /// </summary> /// <param name="combo">Gtk.ComboBoxEntry</param> /// <param name="special">If true, add the Browse_Text to the Gtk.ComboBoxEntry</param> /// <history> /// [Curtis_Beard] 11/03/2006 Created /// </history> private void ClearComboBoxEntries(Gtk.ComboBoxEntry combo, bool special) { for (int i = 0; i < combo.Model.IterNChildren(); i++) combo.RemoveText(i); combo.Active = -1; }
/// <summary> /// Add an item to the Gtk.ComboBoxEntry. /// </summary> /// <param name="combo">Gtk.ComboBoxEntry</param> /// <param name="item">string value to add</param> private void AddComboSelection(Gtk.ComboBoxEntry combo, string item) { // remove any old instance RemoveComboBoxEntry(combo, item); // insert the item at the top combo.PrependText(item); // set the item to be the active one combo.Active = 0; // Only store as many paths as has been set in options. if (combo.Model.IterNChildren() > Core.GeneralSettings.MaximumMRUPaths) { // Remove the last item in the list. combo.RemoveText(combo.Model.IterNChildren() - 1); } }
/// <summary> /// Remove the first entry of the item from the Gtk.ComboBoxEntry. /// </summary> /// <param name="combo">Gtk.ComboBoxEntry</param> /// <param name="item">string value to remove</param> private void RemoveComboBoxEntry(Gtk.ComboBoxEntry combo, string item) { int index = FindComboBoxEntry(combo, item); if (index != -1) combo.RemoveText(index); }