//if column == 1 returns checkboxes column. If is 2 returns column 2... //Attention: Used on checkboxes treeviews public string [] GetColumn(int column, bool onlyActive) { //to store active or inactive status of curves string [] checkboxes = new string[UtilGtk.CountRows(store)]; int count = 0; Gtk.TreeIter iter; bool okIter = store.GetIterFirst(out iter); if (okIter) { do { if (column == 1) { if ((bool)store.GetValue(iter, 1)) { checkboxes[count++] = "active"; } else { checkboxes[count++] = "inactive"; } } else if ((bool)store.GetValue(iter, 1) || !onlyActive) { checkboxes[count++] = ((string)store.GetValue(iter, column)); } } while (store.IterNext(ref iter)); } if (column == 1) { return(checkboxes); } else { string [] checkboxesWithoutGaps = new string[count]; for (int i = 0; i < count; i++) { checkboxesWithoutGaps[i] = checkboxes[i]; } return(checkboxesWithoutGaps); } }
void on_button_delete_clicked(object o, EventArgs args) { string selectedName = getSelectedName(); if (selectedName == "") { return; } if (UtilGtk.CountRows(store) <= 1) { new DialogMessage(Constants.MessageTypes.WARNING, Catalog.GetString("Sorry, cannot delete all rows.") + "\n"); return; } //treeview UtilGtk.RemoveRow(treeview_select, store); //1 delete row UtilGtk.TreeviewSelectFirstRow(treeview_select, store, true); //2 selects another row (use first) //SQL Sqlite.DeleteFromName(false, Constants.EncoderConfigurationTable, "name", selectedName); }