public static void CargarListaCafeteria(ref Gtk.ListStore listaStore) { listaStore.Clear(); MySQL.consultar("SELECT `ID_articulo`, `descripcion`, `precio` FROM cafeteria_articulos"); /* // Miremos primero si no han agregado este articulo a la lista TreeIter iter = new TreeIter(); Boolean Encontrado = false; if (MySQL.Reader.Read() && tvLista.Model.GetIterFirst(ref iter)) { do { if (tvLista.Model.GetValue(iter,0).ToString() == MySQL.Reader["ID_articulo"].ToString()) { int CantidadActual = int.Parse(tvLista.Model.GetValue (iter, 1).ToString()); tvLista.Model.SetValue(iter,1,++CantidadActual); Encontrado = true; } } while(tvLista.Model.IterNext(ref iter)); } if (!Encontrado && MySQL.Reader.HasRows) listaStore.AppendValues (MySQL.Reader["ID_articulo"].ToString(),MySQL.Reader["codigo_barra"].ToString(), 0, MySQL.Reader["descripcion"].ToString(),double.Parse(MySQL.Reader["precio"].ToString())); */ while (MySQL.Reader.Read()) listaStore.AppendValues (MySQL.Reader["ID_articulo"].ToString(), 0, MySQL.Reader["descripcion"].ToString(),double.Parse(MySQL.Reader["precio"].ToString())); }
private void FillTestComboBox(Gtk.ComboBox cb) { cb.Clear(); CellRendererText cell = new CellRendererText(); cb.PackStart(cell, false); cb.AddAttribute(cell, "text", 0); ListStore store = new ListStore(typeof (string)); cb.Model = store; store.AppendValues("BitBlt"); store.AppendValues("Ellipse"); store.AppendValues("Polygon"); store.AppendValues("LineTo"); store.AppendValues("PolylineTo"); }
private void fill_themes_combo(Gtk.ComboBox box) { box.Clear(); CellRendererText cell = new CellRendererText(); box.PackStart(cell, false); box.AddAttribute(cell, "text", 0); ListStore store = new ListStore(typeof(string)); box.Model = store; TreeIter iter; string cur_theme = Conf.Get(Preference.THEME, Defines.DEFAULT_THEME); cur_theme = cur_theme.Substring(cur_theme.LastIndexOf("/") + 1); IList themes = Application.TheApp.ThemeManager.GetThemeList(); foreach(Theme t in themes){ iter = store.AppendValues(t.Name); if(t.Name == cur_theme){ box.SetActiveIter(iter); } } }
public void PerformCopy(Gtk.Clipboard clipboard) { if (selectionRelativeIndex > 0) { clipboard.Text = GetText (linePos, textPos, selectionRelativeIndex); } else if (selectionRelativeIndex < 0) { Position p = IndexToPosition (PositionToIndex (new Position (linePos, textPos)) + selectionRelativeIndex); clipboard.Text = GetText (p.Line, p.Offset, -selectionRelativeIndex); } else clipboard.Clear (); }
protected void updateSymbolTable(Hashtable symbolTable, Gtk.ListStore symbolTree) { symbolTree.Clear (); foreach(DictionaryEntry pair in symbolTable) { symbolTree.AppendValues (pair.Key, pair.Value); } }
public void PerformCopy (Gtk.Clipboard clipboard) { if (HasSelection ()) { StringBuilder strbld = new StringBuilder (); TextPosition start = TextPosition.Min (currentPos, selectionStart); TextPosition end = TextPosition.Max (currentPos, selectionStart); ForeachLine (start, end, (currentLinePos, strpos, endpos) =>{ if (endpos - strpos > 0) strbld.AppendLine (lines[currentLinePos].Substring (strpos, endpos - strpos)); else if (endpos == strpos) strbld.AppendLine (); }); strbld.Remove (strbld.Length - Environment.NewLine.Length, Environment.NewLine.Length); clipboard.Text = strbld.ToString (); } else clipboard.Clear (); }