public ToolBarComboBox(int width, int activeIndex, bool allowEntry, params string[] contents) { if (allowEntry) { ComboBox = new ComboBoxEntry(contents); } else { Model = new ListStore(typeof(string), typeof(object)); if (contents != null) { foreach (string entry in contents) { Model.AppendValues(entry, null); } } ComboBox = CreateComboBox(Model); //ComboBox.Model = Model; } ComboBox.AddEvents((int)Gdk.EventMask.ButtonPressMask); ComboBox.WidthRequest = width; if (activeIndex >= 0) { ComboBox.Active = activeIndex; } ComboBox.Show(); Add(ComboBox); Show(); }
public ToolBarComboBox(int width, int activeIndex, bool allowEntry, params string[] contents) { if (allowEntry) { ComboBox = new ComboBoxEntry(contents); } else { Model = new ListStore(typeof(string), typeof(object)); if (contents != null) { foreach (string entry in contents) { Model.AppendValues(entry, null); } } ComboBox = new ComboBox(); ComboBox.Model = Model; CellRendererText = new CellRendererText(); ComboBox.PackStart(CellRendererText, false); ComboBox.AddAttribute(CellRendererText, "text", 0); } ComboBox.AddEvents((int)Gdk.EventMask.ButtonPressMask); ComboBox.WidthRequest = width; if (activeIndex >= 0) { ComboBox.Active = activeIndex; } ComboBox.Show(); Add(ComboBox); Show(); }