void PopulateCategoryOptionMenu(Tag t) { int history = 0; int i = 0; categories = new List <Tag> (); var root = db.Tags.RootCategory; categories.Add(root); PopulateCategories(categories, root); category_option_menu.Clear(); var cell2 = new CellRendererPixbuf(); category_option_menu.PackStart(cell2, false); category_option_menu.AddAttribute(cell2, "pixbuf", 0); var cell = new CellRendererText(); category_option_menu.PackStart(cell, true); category_option_menu.AddAttribute(cell, "text", 1); var store = new ListStore(new[] { typeof(Gdk.Pixbuf), typeof(string) }); category_option_menu.Model = store; foreach (Category category in categories) { if (t.Category == category) { history = i; } i++; string categoryName = category.Name; Gdk.Pixbuf categoryImage = category.Icon; store.AppendValues(new object[] { categoryImage, categoryName }); } category_option_menu.Sensitive = true; category_option_menu.Active = history; //category_option_menu.SetHistory ((uint)history); //category_option_menu.Active = (uint)history; }
public ApplicationWidget(Project project,Gtk.Window parent) { parentWindow =parent; this.Build(); this.project = project; cbType = new ComboBox(); ListStore projectModel = new ListStore(typeof(string), typeof(string)); CellRendererText textRenderer = new CellRendererText(); cbType.PackStart(textRenderer, true); cbType.AddAttribute(textRenderer, "text", 0); cbType.Model= projectModel; TreeIter ti = new TreeIter(); foreach(SettingValue ds in MainClass.Settings.ApplicationType){// MainClass.Settings.InstallLocations){ if(ds.Value == this.project.ApplicationType){ ti = projectModel.AppendValues(ds.Display,ds.Value); cbType.SetActiveIter(ti); } else projectModel.AppendValues(ds.Display,ds.Value); } if(cbType.Active <0) cbType.Active =0; tblGlobal.Attach(cbType, 1, 2, 0,1, AttachOptions.Fill|AttachOptions.Expand, AttachOptions.Fill|AttachOptions.Expand, 0, 0); afc = new ApplicationFileControl(project.AppFile,ApplicationFileControl.Mode.EditNoSaveButton,parentWindow); vbox2.PackEnd(afc, true, true, 0); }
protected void InitializeExtraWidget() { PlaylistFormatDescription [] formats = PlaylistFileUtil.ExportFormats; int default_export_index = PlaylistFileUtil.GetFormatIndex(formats, playlist); // Build custom widget used to select the export format. store = new ListStore(typeof(string), typeof(PlaylistFormatDescription)); foreach (PlaylistFormatDescription format in formats) { store.AppendValues(format.FormatName, format); } HBox hBox = new HBox(false, 2); combobox = new ComboBox(store); CellRendererText crt = new CellRendererText(); combobox.PackStart(crt, true); combobox.SetAttributes(crt, "text", 0); combobox.Active = default_export_index; combobox.Changed += OnComboBoxChange; hBox.PackStart(new Label(Catalog.GetString("Select Format: ")), false, false, 0); hBox.PackStart(combobox, true, true, 0); combobox.ShowAll(); hBox.ShowAll(); ExtraWidget = hBox; }
public ComboBoxHelper( ComboBox comboBox, IDbConnection dbConnection, string keyFieldName, string valueFieldName, string tableName, int id) { this.comboBox = comboBox; CellRendererText cellRendererText = new CellRendererText(); comboBox.PackStart (cellRendererText, true); comboBox.AddAttribute (cellRendererText, "text", 1); listStore = new ListStore(typeof(int), typeof(string)); TreeIter initialTreeIter = listStore.AppendValues(0, "<sin asignar>"); IDbCommand dbCommand = dbConnection.CreateCommand (); dbCommand.CommandText = string.Format(selectFormat, keyFieldName, valueFieldName, tableName); IDataReader dataReader = dbCommand.ExecuteReader (); while (dataReader.Read ()) { int key = (int)dataReader[keyFieldName]; string value = (string)dataReader[valueFieldName]; TreeIter treeIter = listStore.AppendValues (key, value); if (key == id) initialTreeIter = treeIter; } dataReader.Close (); comboBox.Model = listStore; comboBox.SetActiveIter (initialTreeIter); }
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 (); }
public void Initialize (EditSession session) { this.session = session; //if standard values are supported by the converter, then //we list them in a combo if (session.Property.Converter.GetStandardValuesSupported (session)) { store = new ListStore (typeof(string), typeof(object)); //if converter doesn't allow nonstandard values, or can't convert from strings, don't have an entry if (session.Property.Converter.GetStandardValuesExclusive (session) || !session.Property.Converter.CanConvertFrom (session, typeof(string))) { combo = new ComboBox (store); var crt = new CellRendererText (); combo.PackStart (crt, true); combo.AddAttribute (crt, "text", 0); } else { combo = new ComboBoxEntry (store, 0); entry = ((ComboBoxEntry)combo).Entry; entry.HeightRequest = combo.SizeRequest ().Height; } PackStart (combo, true, true, 0); combo.Changed += TextChanged; //fill the list foreach (object stdValue in session.Property.Converter.GetStandardValues (session)) { store.AppendValues (session.Property.Converter.ConvertToString (session, stdValue), ObjectBox.Box (stdValue)); } //a value of "--" gets rendered as a --, if typeconverter marked with UsesDashesForSeparator object[] atts = session.Property.Converter.GetType () .GetCustomAttributes (typeof (StandardValuesSeparatorAttribute), true); if (atts.Length > 0) { string separator = ((StandardValuesSeparatorAttribute)atts[0]).Separator; combo.RowSeparatorFunc = (model, iter) => separator == ((string)model.GetValue (iter, 0)); } } // no standard values, so just use an entry else { entry = new Entry (); PackStart (entry, true, true, 0); } //if we have an entry, fix it up a little if (entry != null) { entry.HasFrame = false; entry.Changed += TextChanged; entry.FocusOutEvent += FirePendingChangeEvent; } if (entry != null && ShouldShowDialogButton ()) { var button = new Button ("..."); PackStart (button, false, false, 0); button.Clicked += ButtonClicked; } Spacing = 3; ShowAll (); }
public ComboBoxDialog() { Title = "Gtk Combo Box Dialog"; WidthRequest = 500; HeightRequest = 400; var vbox = new VBox (); this.VBox.PackStart (vbox); comboBox = new ComboBox (); vbox.PackStart (comboBox, false, false, 0); listStore = new ListStore (typeof(string), typeof(ComboBoxItem)); comboBox.Model = listStore; var cell = new CellRendererText (); comboBox.PackStart (cell, true); comboBox.AddAttribute (cell, "text", 0); AddItems (); Child.ShowAll (); Show (); }
public static void Fill(ComboBox comboBox, QueryResult queryResult) { CellRendererText cellRenderText = new CellRendererText (); comboBox.PackStart (cellRenderText, false); comboBox.SetCellDataFunc(cellRenderText, delegate(CellLayout Cell_layout, CellRenderer CellView, TreeModel tree_model, TreeIter iter) { IList row = (IList)tree_model.GetValue(iter, 0); cellRenderText.Text = row[1].ToString(); //Vamos a ver el uso de los parámetros para acceder a SQL }); ListStore listStore = new ListStore (typeof(IList)); //TODO localización de "Sin Asignar". IList first = new object[] { null, "<sin asignar>" }; TreeIter treeIterFirst = listStore.AppendValues (first); //TreeIter treeIterFirst = ListStore.AppendValues(first); foreach (IList row in queryResult.Rows) listStore.AppendValues (row); comboBox.Model = listStore; //Por defecto vale -1 (para el indice de categoría) comboBox.Active = 0; comboBox.SetActiveIter(treeIterFirst); }
public ComboBoxHelper(IDbConnection dbConnection,ComboBox comboBox,string nombre, string id,int elementoInicial,string tabla) { this.comboBox=comboBox; IDbCommand dbCommand= dbConnection.CreateCommand(); dbCommand.CommandText = string.Format(selectFormat,id,nombre,tabla); IDataReader dbDataReader= dbCommand.ExecuteReader(); // CellRendererText cell1=new CellRendererText(); // comboBox.PackStart(cell1,false); // comboBox.AddAttribute(cell1,"text",0); CellRendererText cell2=new CellRendererText(); comboBox.PackStart(cell2,false); comboBox.AddAttribute(cell2,"text",1);//añadimos columnas liststore=new ListStore(typeof(int),typeof(string)); TreeIter initialIter= liststore.AppendValues(0,"<sin asignar>");//si el elemento inicial no existe se selecciona esta opcion while(dbDataReader.Read()){ int id2=(int)dbDataReader[id]; string nombre2=dbDataReader[nombre].ToString(); TreeIter iter=liststore.AppendValues(id2,nombre2); if(elementoInicial==id2) initialIter=iter; } dbDataReader.Close(); comboBox.Model=liststore; comboBox.SetActiveIter(initialIter); }
public ComboBoxHelper(ComboBox comboBox, object id, string selectSql) { CellRendererText cellRendererText = new CellRendererText (); comboBox.PackStart (cellRendererText, false); comboBox.SetCellDataFunc (cellRendererText, new CellLayoutDataFunc (delegate(CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter) { cellRendererText.Text = ((object[])tree_model.GetValue(iter, 0))[1].ToString(); })); ListStore listStore = new ListStore (typeof(object)); object[] initial = new object[] { null, "<sin asignar>" }; TreeIter initialTreeIter = listStore.AppendValues ((object)initial); IDbCommand dbCommand = App.Instance.DbConnection.CreateCommand (); dbCommand.CommandText = selectSql; IDataReader dataReader = dbCommand.ExecuteReader (); while (dataReader.Read()) { object currentId = dataReader [0]; object currentName = dataReader [1]; object[] values = new object[] { currentId, currentName }; TreeIter treeIter = listStore.AppendValues ((object)values); if (currentId.Equals (id)) initialTreeIter = treeIter; } dataReader.Close (); comboBox.Model = listStore; comboBox.SetActiveIter (initialTreeIter); }
void llenacombo_contrato() { combo_tipocontrato.Clear(); CellRendererText cell = new CellRendererText(); combo_tipocontrato.PackStart(cell, true); combo_tipocontrato.AddAttribute(cell, "text", 0); ListStore store = new ListStore(typeof(string)); combo_tipocontrato.Model = store; store.AppendValues((string)""); store.AppendValues((string)"DETERMINADO (1 MES)"); store.AppendValues((string)"DETERMINADO (2 MESES)"); store.AppendValues((string)"DETERMINADO (3 MESES)"); store.AppendValues((string)"INDETERMINADO"); store.AppendValues((string)"HONORARIOS (ASIMILABLES)"); store.AppendValues((string)"PRACTICAS"); TreeIter iter; if (store.GetIterFirst(out iter)) { combo_tipocontrato.SetActiveIter(iter); } combo_tipocontrato.Changed += new EventHandler(onComboBoxChanged_tipocontrato); }
public PreferencesDialog(ITranslations translations, PlayerHistory history) : base(translations, "PreferencesDialog.ui", "preferences") { this.history = history; prefspinbutton.Value = Preferences.Get <int> (Preferences.MemQuestionTimeKey); prefcheckbutton.Active = Preferences.Get <bool> (Preferences.MemQuestionWarnKey); maxstoredspinbutton.Value = Preferences.Get <int> (Preferences.MaxStoredGamesKey); minplayedspinbutton.Value = Preferences.Get <int> (Preferences.MinPlayedGamesKey); colorblindcheckbutton.Active = Preferences.Get <bool> (Preferences.ColorBlindKey); englishcheckbutton.Active = Preferences.Get <bool> (Preferences.EnglishKey); loadextensionscheckbutton.Active = Preferences.Get <bool> (Preferences.LoadPlugginsKey); usesoundscheckbutton.Active = Preferences.Get <bool> (Preferences.SoundsKey); switch ((GameDifficulty)Preferences.Get <int> (Preferences.DifficultyKey)) { case GameDifficulty.Easy: rb_easy.Active = rb_easy.HasFocus = true; break; case GameDifficulty.Medium: rb_medium.Active = rb_medium.HasFocus = true; break; case GameDifficulty.Master: rb_master.Active = rb_master.HasFocus = true; break; } ListStore store = new ListStore(typeof(string), typeof(Theme)); // DisplayName, theme reference CellRenderer layout_cell = new CellRendererText(); themes_combobox.Model = store; themes_combobox.PackStart(layout_cell, true); themes_combobox.SetCellDataFunc(layout_cell, ComboBoxCellFunc); foreach (Theme theme in ThemeManager.Themes) { store.AppendValues(Catalog.GetString(theme.LocalizedName), theme); } // Default value TreeIter iter; bool more = store.GetIterFirst(out iter); while (more) { Theme theme = (Theme)store.GetValue(iter, COLUMN_VALUE); if (String.Compare(theme.Name, Preferences.Get <string> (Preferences.ThemeKey), true) == 0) { themes_combobox.SetActiveIter(iter); break; } more = store.IterNext(ref iter); } #if !MONO_ADDINS loadextensionscheckbutton.Visible = false; #endif }
void llena_horas_notas() { combobox_hora_nota.Clear(); CellRendererText cell2 = new CellRendererText(); combobox_hora_nota.PackStart(cell2, true); combobox_hora_nota.AddAttribute(cell2, "text", 0); ListStore store2 = new ListStore(typeof(string), typeof(int)); combobox_hora_nota.Model = store2; for (int i = 1; i < (int)classpublic.horario_24_horas + 1; i++) { store2.AppendValues((string)i.ToString("00").Trim()); } combobox_hora_nota.Changed += new EventHandler(onComboBoxChanged_hora_minutos_cita); combobox_minutos_nota.Clear(); CellRendererText cell3 = new CellRendererText(); combobox_minutos_nota.PackStart(cell3, true); combobox_minutos_nota.AddAttribute(cell3, "text", 0); ListStore store3 = new ListStore(typeof(string), typeof(int)); combobox_minutos_nota.Model = store3; for (int i = (int)0; i < 60; i = i + (int)classpublic.intervalo_minutos) { store3.AppendValues((string)i.ToString("00").Trim()); } combobox_minutos_nota.Changed += new EventHandler(onComboBoxChanged_hora_minutos_cita); combobox_hora_somato.Clear(); CellRendererText cell4 = new CellRendererText(); combobox_hora_somato.PackStart(cell4, true); combobox_hora_somato.AddAttribute(cell4, "text", 0); ListStore store4 = new ListStore(typeof(string), typeof(int)); combobox_hora_somato.Model = store4; for (int i = 1; i < (int)classpublic.horario_24_horas + 1; i++) { store4.AppendValues((string)i.ToString("00").Trim()); } combobox_hora_somato.Changed += new EventHandler(onComboBoxChanged_hora_minutos_cita); combobox_minutos_somato.Clear(); CellRendererText cell5 = new CellRendererText(); combobox_minutos_somato.PackStart(cell5, true); combobox_minutos_somato.AddAttribute(cell5, "text", 0); ListStore store5 = new ListStore(typeof(string), typeof(int)); combobox_minutos_somato.Model = store5; for (int i = (int)0; i < 60; i = i + (int)classpublic.intervalo_minutos) { store5.AppendValues((string)i.ToString("00").Trim()); } combobox_minutos_somato.Changed += new EventHandler(onComboBoxChanged_hora_minutos_cita); }
public void ShowWindow() { Application.Init(); gxml = new Glade.XML("contactviewer.glade", "MainWindow"); gxml.Autoconnect(this); ActionEntry[] entries = new ActionEntry [] { new ActionEntry("FileMenuAction", null, "_File", null, null, null), new ActionEntry("OpenAction", Gtk.Stock.Open, "_Open", "<control>O", Catalog.GetString("Open..."), new EventHandler(OnOpenDatabase)), new ActionEntry("QuitAction", Gtk.Stock.Quit, "_Quit", "<control>Q", Catalog.GetString("Quit"), new EventHandler(OnQuit)), new ActionEntry("HelpMenuAction", null, "_Help", null, null, null), new ActionEntry("AboutAction", Gnome.Stock.About, "_About", null, Catalog.GetString("About"), new EventHandler(OnAbout)) }; ActionGroup grp = new ActionGroup("MainGroup"); grp.Add(entries); ui_manager = new UIManager(); ui_manager.InsertActionGroup(grp, 0); ui_manager.AddUiFromResource("menu.xml"); MenubarHolder.Add(ui_manager.GetWidget("/MainMenu")); // Fix the TreeView that will contain all contacts contact_store = new ListStore(typeof(string), typeof(string)); ContactList.Model = contact_store; ContactList.RulesHint = true; ContactList.AppendColumn(Catalog.GetString("Contacts"), new CellRendererText(), "text", 1); ContactList.ButtonReleaseEvent += OnContactSelected; // This ListStore will let the user choose what to see in the contact list contact_show_type_store = new ListStore(typeof(string), typeof(string)); contact_show_type_store.AppendValues("DisplayName", Catalog.GetString("Display name")); contact_show_type_store.AppendValues("PrimaryEmail", Catalog.GetString("Primary E-mail")); contact_show_type_store.AppendValues("SecondEmail", Catalog.GetString("Secondary E-mail")); contact_show_type_store.AppendValues("NickName", Catalog.GetString("Nickname")); CellRendererText cell = new CellRendererText(); ListIdentifier.PackStart(cell, false); ListIdentifier.AddAttribute(cell, "text", 1); ListIdentifier.Model = contact_show_type_store; ListIdentifier.Active = 0; ListIdentifier.Changed += OnContactListTypeChanged; MainWindow.Icon = Beagle.Images.GetPixbuf("contact-icon.png"); MainWindow.DeleteEvent += OnDeleteEvent; LoadDatabase(); Application.Run(); }
/// <summary>Constructor</summary> public DropDownView(ViewBase owner) : base(owner) { combobox1 = new ComboBox(comboModel); _mainWidget = combobox1; combobox1.PackStart(comboRender, false); combobox1.AddAttribute(comboRender, "text", 0); combobox1.Changed += OnSelectionChanged; _mainWidget.Destroyed += _mainWidget_Destroyed; }
public ComboBoxHelper(ComboBox comboBox, IDbConnection dbConnection, string keyFieldName, string valueFieldName,string tableName,int initialId) { this.comboBox = comboBox; //this.initalId = initialId; CellRendererText cellRenderText1 = new CellRendererText(); comboBox.PackStart(cellRenderText1,false); comboBox.AddAttribute(cellRenderText1,"text",0);//el ultimo parametro el 0 sirve para elegir la columna a visualizar CellRendererText cellRenderText = new CellRendererText(); comboBox.PackStart(cellRenderText,false); comboBox.AddAttribute(cellRenderText,"text",1);//el ultimo parametro el 1 sirve para elegir la columna a visualizar listStore = new ListStore(typeof(int),typeof(string)); TreeIter initialTreeIter;/* = listStore.AppendValues(0, "Sin asignar");*/ IDbCommand dbCommand = dbConnection.CreateCommand(); dbCommand.CommandText = string.Format(selectFormat, keyFieldName,valueFieldName,tableName); IDataReader dataReader = dbCommand.ExecuteReader(); //Recorre el dataReader para insertar los valores en el comboBox while(dataReader.Read()) { int id =(int) dataReader["id"]; string nombre = (string)dataReader["nombre"]; treeIter = listStore.AppendValues(id,nombre); if (id == initialId) initialTreeIter = treeIter; } dataReader.Close(); comboBox.Model = listStore; comboBox.SetActiveIter(initialTreeIter); comboBox.Changed += delegate { TreeIter treeIter; comboBox.GetActiveIter(out treeIter); int id = (int) listStore.GetValue(treeIter,0); Console.WriteLine("ID = "+ id); }; }
void FillCombo (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; }
/// <summary>Constructor</summary> public ColourDropDownView(ViewBase owner) : base(owner) { combobox1 = new ComboBox(comboModel); _mainWidget = combobox1; combobox1.PackStart(comboRender, true); combobox1.AddAttribute(comboRender, "text", 0); combobox1.SetCellDataFunc(comboRender, OnDrawColourCombo); combobox1.Changed += OnChanged; _mainWidget.Destroyed += _mainWidget_Destroyed; }
public static void FillSizeCombo(ComboBox combo, string[] sizes) { combo.Clear (); var list = new ListStore (typeof(string)); foreach (var size in sizes) list.AppendValues (size); combo.Model = list; CellRendererText text = new CellRendererText (); combo.PackStart (text, true); combo.AddAttribute (text, "text", 0); }
protected override ComboBox CreateComboBox () { var box = new ComboBox (); cell_renderer = new CellRendererText (); box.PackStart (cell_renderer, false); box.AddAttribute (cell_renderer, "text", 0); box.SetCellDataFunc (cell_renderer, new CellLayoutDataFunc (RenderFont)); return box; }
//utility method to clear a gtk combobox private void clearComboBox() { Gtk.ComboBox cb = this.loadComboBox; cb.Clear(); CellRendererText cell = new CellRendererText(); cb.PackStart(cell, false); cb.AddAttribute(cell, "text", 0); ListStore store = new ListStore(typeof(string)); cb.Model = store; }
public static void Fill(ComboBox combobox, QueryResult queryResult) { CellRendererText cellRendererText = new CellRendererText (); combobox.PackStart (cellRendererText, false); combobox.SetCellDataFunc (cellRendererText, delegate(CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter) { IList row = (IList)tree_model.GetValue (iter, 0); cellRendererText.Text = row [1].ToString (); }); ListStore listStore = new ListStore (typeof(IList)); foreach (IList row in queryResult.Rows) listStore.AppendValues (row); combobox.Model = listStore; }
public override Widget ConfigurationWidget () { VBox vbox = new VBox (); Label info = new Label (Catalog.GetString ("Select the area that needs cropping.")); constraints_combo = new ComboBox (); CellRendererText constraint_name_cell = new CellRendererText (); CellRendererPixbuf constraint_pix_cell = new CellRendererPixbuf (); constraints_combo.PackStart (constraint_name_cell, true); constraints_combo.PackStart (constraint_pix_cell, false); constraints_combo.SetCellDataFunc (constraint_name_cell, new CellLayoutDataFunc (ConstraintNameCellFunc)); constraints_combo.SetCellDataFunc (constraint_pix_cell, new CellLayoutDataFunc (ConstraintPixCellFunc)); constraints_combo.Changed += HandleConstraintsComboChanged; // FIXME: need tooltip Catalog.GetString ("Constrain the aspect ratio of the selection") LoadPreference (Preferences.CUSTOM_CROP_RATIOS); vbox.Add (info); vbox.Add (constraints_combo); return vbox; }
public void Run(IBrowsableCollection selection) { CreateDialog(); items = selection.Items; if (items.Length > 60) { HigMessageDialog mbox = new HigMessageDialog(Dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Too many images to export"), Catalog.GetString("Facebook only permits 60 photographs per album. Please refine your selection and try again.")); mbox.Run(); mbox.Destroy(); return; } captions = new string [items.Length]; tags = new List <Mono.Facebook.Tag> [items.Length]; thumbnail_iconview = new FSpot.Widgets.IconView(selection); thumbnail_iconview.DisplayDates = false; thumbnail_iconview.DisplayTags = false; thumbnail_iconview.ButtonPressEvent += HandleThumbnailIconViewButtonPressEvent; thumbnail_iconview.KeyPressEvent += HandleThumbnailIconViewKeyPressEvent; thumbnail_iconview.Show(); thumbnails_scrolled_window.Add(thumbnail_iconview); login_button.Visible = true; login_button.Clicked += HandleLoginClicked; logout_button.Visible = false; logout_button.Clicked += HandleLogoutClicked; whoami_label.Text = Catalog.GetString("You are not logged in."); album_info_vbox.Sensitive = false; picture_info_vbox.Sensitive = false; create_album_radiobutton.Toggled += HandleCreateAlbumToggled; create_album_radiobutton.Active = true; existing_album_radiobutton.Toggled += HandleExistingAlbumToggled; CellRendererText cell = new CellRendererText(); existing_album_combobox.PackStart(cell, false); tag_image_eventbox.ButtonPressEvent += HandleTagImageButtonPressEvent; Dialog.Response += HandleResponse; Dialog.Show(); }
public BindDesignDialog(string id, ArrayList validClasses, string baseFolder) { XML glade = new XML(null, "gui.glade", "BindDesignDialog", null); glade.Autoconnect(this); labelMessage.Text = GettextCatalog.GetString("The widget design {0} is not currently bound to a class.", id); fileEntry = new FolderEntry(); fileEntryBox.Add(fileEntry); fileEntry.ShowAll(); if (validClasses.Count > 0) { store = new ListStore(typeof(string)); foreach (string cname in validClasses) { store.AppendValues(cname); } comboClasses.Model = store; CellRendererText cr = new CellRendererText(); comboClasses.PackStart(cr, true); comboClasses.AddAttribute(cr, "text", 0); comboClasses.Active = 0; } else { radioSelect.Sensitive = false; radioCreate.Active = true; } fileEntry.Path = baseFolder; // Initialize the class name using the widget name int i = id.IndexOf('.'); if (i != -1) { entryClassName.Text = id.Substring(i + 1); entryNamespace.Text = id.Substring(0, i); } else { entryClassName.Text = id; entryNamespace.Text = lastNamespace; } dialog.Response += new Gtk.ResponseHandler(OnResponse); UpdateStatus(); }
private void SetupExportPlugins() { ListStore model = new ListStore(typeof(string), typeof(ExportPlugin)); foreach(ExportPlugin plugin in pluginManager.Plugins) { model.AppendValues(plugin.Description, plugin); } Gtk.CellRenderer renderer = new Gtk.CellRendererText(); ExportAsCombo.PackStart(renderer, false); ExportAsCombo.AddAttribute(renderer, "text", 0); ExportAsCombo.Model = model; ExportAsCombo.Active = 0; }
void llenado_combobox_tipo_paciente() { // Llenado de combobox combobox_tipo_admision.Clear(); CellRendererText cell2 = new CellRendererText(); combobox_tipo_admision.PackStart(cell2, true); combobox_tipo_admision.AddAttribute(cell2, "text", 0); ListStore store2 = new ListStore(typeof(string), typeof(int)); combobox_tipo_admision.Model = store2; // lleno de la tabla de his_tipo_de_admisiones NpgsqlConnection conexion; conexion = new NpgsqlConnection(connectionString + nombrebd); // Verifica que la base de datos este conectada try{ conexion.Open(); NpgsqlCommand comando; comando = conexion.CreateCommand(); comando.CommandText = "SELECT * FROM osiris_his_tipo_admisiones " + "WHERE cuenta_mayor = 4000 " + "ORDER BY descripcion_admisiones;"; NpgsqlDataReader lector = comando.ExecuteReader(); store2.AppendValues("", 0); while (lector.Read()) { store2.AppendValues((string)lector["descripcion_admisiones"], (int)lector["id_tipo_admisiones"]); } }catch (NpgsqlException ex) { MessageDialog msgBoxError = new MessageDialog(MyWinError, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, "PostgresSQL error: {0}", ex.Message); msgBoxError.Run(); msgBoxError.Destroy(); } conexion.Close(); TreeIter iter2; if (store2.GetIterFirst(out iter2)) { //Console.WriteLine(iter2); combobox_tipo_admision.SetActiveIter(iter2); } combobox_tipo_admision.Changed += new EventHandler(onComboBoxChanged_tipo_admision); }
private void PopulateComboBox(ComboBox combobox, string active, IEnumerable<string> enumerable) { ListStore model = new ListStore (typeof (string)); combobox.Model = model; foreach (string s in enumerable) { TreeIter iter = model.AppendValues (s); if (s == active) combobox.SetActiveIter (iter); } CellRendererText cr = new CellRendererText (); combobox.PackStart (cr, false); combobox.AddAttribute (cr, "text", 0); }
/// <summary> /// Regenera un dropdown segun una lista pasada /// </summary> /// <param name="cb">ComboBox.</param> /// <param name="valores">Lista.</param> private void RepopulateComboBox(Gtk.ComboBox cb, List <string> valores) { cb.Clear(); CellRendererText cell = new CellRendererText(); cb.PackStart(cell, false); cb.AddAttribute(cell, "text", 0); ListStore store = new ListStore(typeof(string)); cb.Model = store; foreach (string str in valores) { cb.AppendText(str); } }
void llenado_municipios(string tipo_, string descripcionmunicipio_) { combobox_municipios.Clear(); CellRendererText cell3 = new CellRendererText(); combobox_municipios.PackStart(cell3, true); combobox_municipios.AddAttribute(cell3, "text", 0); ListStore store3 = new ListStore(typeof(string)); combobox_municipios.Model = store3; if (tipo_ == "selecciona") { store3.AppendValues((string)descripcionmunicipio_); } NpgsqlConnection conexion; conexion = new NpgsqlConnection(connectionString + nombrebd); // Verifica que la base de datos este conectada try{ conexion.Open(); NpgsqlCommand comando; comando = conexion.CreateCommand(); comando.CommandText = "SELECT descripcion_municipio FROM osiris_municipios WHERE id_estado = '" + idestado.ToString() + "' " + "ORDER BY descripcion_municipio;"; NpgsqlDataReader lector = comando.ExecuteReader(); while (lector.Read()) { store3.AppendValues((string)lector["descripcion_municipio"]); } }catch (NpgsqlException ex) { MessageDialog msgBoxError = new MessageDialog(MyWinError, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, "PostgresSQL error: {0}", ex.Message); msgBoxError.Run(); msgBoxError.Destroy(); } conexion.Close(); TreeIter iter3; if (store3.GetIterFirst(out iter3)) { combobox_municipios.SetActiveIter(iter3); } combobox_municipios.Changed += new EventHandler(onComboBoxChanged_municipios); }
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"); }
public SmugMugAddAlbum(SmugMugExport export, SmugMugApi smugmug) : base("smugmug_add_album_dialog") { this.export = export; this.smugmug = smugmug; this.category_store = new ListStore(typeof(int), typeof(string)); CellRendererText display_cell = new CellRendererText(); category_combo.PackStart(display_cell, true); category_combo.SetCellDataFunc(display_cell, new CellLayoutDataFunc(CategoryDataFunc)); this.category_combo.Model = category_store; PopulateCategoryCombo(); Dialog.Response += HandleAddResponse; title_entry.Changed += HandleChanged; HandleChanged(null, null); }
public static void Fill(ComboBox comboBox, QueryResult queryResult, object id) { CellRendererText cellRendererText = new CellRendererText (); comboBox.PackStart (cellRendererText, false); comboBox.SetCellDataFunc (cellRendererText, delegate(CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter) { IList row = (IList)tree_model.GetValue(iter, 0); cellRendererText.Text = row[1].ToString(); }); ListStore listStore = new ListStore (typeof(IList)); //TODO localización de "sin asignar" IList first = new object[]{null, "<sin asignar>"}; TreeIter treeIterFirst = listStore.AppendValues (first); foreach (IList row in queryResult.Rows) listStore.AppendValues (row); comboBox.Model = listStore; //comboBox.Active = 0; comboBox.SetActiveIter (treeIterFirst); }
public static void Fill(ComboBox comboBox,QueryResult queryResult, object id) { CellRendererText cellRendererText = new CellRendererText (); comboBox.PackStart (cellRendererText, false); comboBox.SetCellDataFunc (cellRendererText, delegate(CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter) { //ESTA Y LA ANTERIOR CREAN LA CAJA PARA DIBUJAR IList row =(IList)tree_model.GetValue(iter,0); cellRendererText.Text = /*row[0] +" - "+*/ row[1].ToString(); // Id - Categoria }); ListStore listStore = new ListStore (typeof(IList)); IList first = new object[] {null, "<sin asignar>"}; TreeIter treeIterAsignado =listStore.AppendValues (first); // lo guardo en un treeIter Para utilizarlo como activo en el comboiBox foreach (IList row in queryResult.Rows) { TreeIter treeIter = listStore.AppendValues (row); if (row[0].Equals(id)) treeIterAsignado = treeIter; } comboBox.Model = listStore; comboBox.SetActiveIter(treeIterAsignado); }
private void populateComboBox(Database db) { // Set up the comboBox. CellRendererText combocell = new CellRendererText(); comboBox.PackStart(combocell, false); comboBox.AddAttribute(combocell, "text", 0); ListStore combostore = new ListStore(typeof(string)); comboBox.Model = combostore; // Take the names of the tables. for (int i = 0; i < db.Tables.Count; ++i) { Model.Table table = db.Tables[i]; combostore.AppendValues(table.Name); } comboBox.Changed += new EventHandler(OnComboBoxChanged); comboBox.ShowAll(); }
public SmugMugAddAlbum(SmugMugExport export, SmugMugApi smugmug) { xml = new Glade.XML(null, "SmugMugExport.glade", dialog_name, "f-spot"); xml.Autoconnect(this); this.export = export; this.smugmug = smugmug; this.category_store = new ListStore(typeof(int), typeof(string)); CellRendererText display_cell = new CellRendererText(); category_combo.PackStart(display_cell, true); category_combo.SetCellDataFunc(display_cell, new CellLayoutDataFunc(CategoryDataFunc)); this.category_combo.Model = category_store; PopulateCategoryCombo(); Dialog.Response += HandleAddResponse; title_entry.Changed += HandleChanged; HandleChanged(null, null); }
public FeedbackControl(TypFeedback type) : base(3,2,false) { typeFeedback = type; this.RowSpacing = 3; this.ColumnSpacing = 3; Label lblSubject = GetLabel("Subject"); this.Attach(lblSubject,0,1,0,1,AttachOptions.Fill,AttachOptions.Fill,0,0); entrSubject = new Entry(); this.Attach(entrSubject,1,2,0,1,AttachOptions.Fill|AttachOptions.Expand,AttachOptions.Fill,0,0); cbType = new ComboBox(); projectModel = new ListStore(typeof(string), typeof(string)); CellRendererText textRenderer = new CellRendererText(); cbType.PackStart(textRenderer, true); cbType.AddAttribute(textRenderer, "text", 0); cbType.Model= projectModel; projectModel.AppendValues("IDE and Emulator","IDE and Emulator" ); projectModel.AppendValues("Framework and Documentation","Framework and Documentation" ); projectModel.AppendValues("Deployment, Devices and Publishing","Deployment, Devices and Publishing" ); projectModel.AppendValues("Web moscrif.com","Web moscrif.com" ); cbType.Active = 0; Label lblVersion = GetLabel("Product Group"); this.Attach(lblVersion,0,1,1,2,AttachOptions.Fill,AttachOptions.Fill,0,0); this.Attach(cbType,1,2,1,2,AttachOptions.Fill|AttachOptions.Expand,AttachOptions.Fill,0,0); Label lblDescription = GetLabel("Description"); this.Attach(lblDescription,0,1,2,3,AttachOptions.Fill,AttachOptions.Fill,0,0); tvDescription = new TextView(); ScrolledWindow sw = new ScrolledWindow (); sw.ShadowType = ShadowType.Out; sw.Add(tvDescription); this.Attach(sw,1,2,2,3,AttachOptions.Fill|AttachOptions.Expand,AttachOptions.Fill|AttachOptions.Expand,0,0); this.ShowAll(); }
public static void Fill(ComboBox combobox1, QueryResult queryresult, object id) { CellRendererText cellRendererText = new CellRendererText (); combobox1.PackStart (cellRendererText, false); combobox1.SetCellDataFunc (cellRendererText, delegate(CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter) { IList row = (IList)tree_model.GetValue (iter, 0); cellRendererText.Text = row[1].ToString(); }); ListStore listStore = new ListStore (typeof(IList)); IList first=new object[]{null,"<sin asignar>"}; TreeIter treeiterId=listStore.AppendValues (first); foreach (IList row in queryresult.Rows) { TreeIter treeiter=listStore.AppendValues (row); if (row[0].Equals(id)) treeiterId = treeiter; } combobox1.Model = listStore; //combobox1.Active = 0; combobox1.SetActiveIter (treeiterId); }
private Gtk.ComboBox FilterComboBox() { filter_data = new Gtk.ListStore(new Type[] { typeof(string), typeof(string) }); Gtk.TreeIter iter; iter = filter_data.Append(); filter_data.SetValue(iter, 0, Catalog.GetString("Anywhere")); filter_data.SetValue(iter, 1, null); iter = filter_data.Append(); filter_data.SetValue(iter, 0, Catalog.GetString("in Files")); filter_data.SetValue(iter, 1, "File"); iter = filter_data.Append(); filter_data.SetValue(iter, 0, Catalog.GetString("in Addressbook")); filter_data.SetValue(iter, 1, "Contact"); iter = filter_data.Append(); filter_data.SetValue(iter, 0, Catalog.GetString("in Mail")); filter_data.SetValue(iter, 1, "MailMessage"); iter = filter_data.Append(); filter_data.SetValue(iter, 0, Catalog.GetString("in Web Pages")); filter_data.SetValue(iter, 1, "WebHistory"); iter = filter_data.Append(); filter_data.SetValue(iter, 0, Catalog.GetString("in Chats")); filter_data.SetValue(iter, 1, "IMLog"); Gtk.ComboBox combo = new Gtk.ComboBox(filter_data); combo.Active = 0; Gtk.CellRendererText renderer = new Gtk.CellRendererText(); combo.PackStart(renderer, false); combo.SetAttributes(renderer, new object[] { "text", 0 }); return(combo); }
public PropertyGrid(ServiceContainer parentServices) { this.parentServices = parentServices; grid = new AspNetEdit.UI.PropertyGrid (); this.PackEnd (grid, true, true, 0); components = new ListStore (typeof (string), typeof (IComponent)); combo = new ComboBox (components); CellRenderer rdr = new CellRendererText (); combo.PackStart (rdr, true); combo.AddAttribute (rdr, "text", 0); this.PackStart (combo, false, false, 3); //for selecting nothing, i.e. deselect all components.AppendValues (new object[] { "", null} ); combo.Changed += new EventHandler (combo_Changed); InitialiseServices(); }
public TimePeriodAdderView(Glade.XML gxml) { startTimeEntry = (Gtk.Entry)gxml.GetWidget ("startTimestampEntry"); endTimeEntry = (Gtk.Entry)gxml.GetWidget ("endTimestampEntry"); blockCommentTextview = (Gtk.TextView)gxml.GetWidget ("blockCommentTextview"); addBlockButton = (Gtk.Button)gxml.GetWidget ("addBlockButton"); cancelBlockButton = (Gtk.Button)gxml.GetWidget ("cancelBlockButton"); startBlockButton = (Gtk.Button)gxml.GetWidget ("startBlockButton"); taskCombobox = (Gtk.ComboBox)gxml.GetWidget ("taskCombobox"); Gtk.CellRendererText colCell = new Gtk.CellRendererText (); taskCombobox.PackStart (colCell, false); taskTree = new Gtk.TreeStore (typeof(string)); taskCombobox.AddAttribute (colCell, "text", 0); taskCombobox.Model = taskTree; notDefiningBlockSensitivity (); }
public DataDatabaseView(string fileName) { hbox = new HBox(); sqlLiteDal = new SqlLiteDal(fileName); lblTable = new Label(MainClass.Languages.Translate("tables")); hbox.PackStart(lblTable,false,false,10); cbTable = new ComboBox(); cbTable.Changed += new EventHandler(OnComboProjectChanged); CellRendererText textRenderer = new CellRendererText(); cbTable.PackStart(textRenderer, true); cbTable.AddAttribute(textRenderer, "text", 0); cbTable.Model = tablesComboModel; cbTable.WidthRequest = 200; hbox.PackStart(cbTable,false,false,2); hbox.PackEnd(new Label(""),true,true,2); this.PackStart(hbox,false,false,5); ScrolledWindow sw = new ScrolledWindow (); sw.ShadowType = ShadowType.EtchedIn; sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic); treeView = new TreeView (tableModel); treeView.RulesHint = true; //treeView.SearchColumn = (int) Column.Description; sw.Add (treeView); this.PackStart(sw,true,true,5); this.ShowAll(); GetTables(); }
public MainToolbar () { executionTargetsChanged = DispatchService.GuiDispatch (new EventHandler (HandleExecutionTargetsChanged)); IdeApp.Workspace.ActiveConfigurationChanged += (sender, e) => UpdateCombos (); IdeApp.Workspace.ConfigurationsChanged += (sender, e) => UpdateCombos (); IdeApp.Workspace.SolutionLoaded += (sender, e) => UpdateCombos (); IdeApp.Workspace.SolutionUnloaded += (sender, e) => UpdateCombos (); IdeApp.ProjectOperations.CurrentSelectedSolutionChanged += HandleCurrentSelectedSolutionChanged; WidgetFlags |= Gtk.WidgetFlags.AppPaintable; AddWidget (button); AddSpace (8); configurationCombo = new Gtk.ComboBox (); configurationCombo.Model = configurationStore; var ctx = new Gtk.CellRendererText (); configurationCombo.PackStart (ctx, true); configurationCombo.AddAttribute (ctx, "text", 0); configurationCombosBox = new HBox (false, 8); var configurationComboVBox = new VBox (); configurationComboVBox.PackStart (configurationCombo, true, false, 0); configurationCombosBox.PackStart (configurationComboVBox, false, false, 0); runtimeCombo = new Gtk.ComboBox (); runtimeCombo.Model = runtimeStore; ctx = new Gtk.CellRendererText (); runtimeCombo.PackStart (ctx, true); runtimeCombo.SetCellDataFunc (ctx, RuntimeRenderCell); runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator; var runtimeComboVBox = new VBox (); runtimeComboVBox.PackStart (runtimeCombo, true, false, 0); configurationCombosBox.PackStart (runtimeComboVBox, false, false, 0); AddWidget (configurationCombosBox); buttonBarBox = new Alignment (0.5f, 0.5f, 0, 0); buttonBarBox.LeftPadding = (uint) 7; buttonBarBox.Add (buttonBar); buttonBarBox.NoShowAll = true; AddWidget (buttonBarBox); AddSpace (24); statusArea = new StatusArea (); statusArea.ShowMessage (BrandingService.ApplicationName); var statusAreaAlign = new Alignment (0, 0, 1, 1); statusAreaAlign.Add (statusArea); contentBox.PackStart (statusAreaAlign, true, true, 0); AddSpace (24); statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => { Gtk.Widget toplevel = this.Toplevel; if (toplevel == null) return; int windowWidth = toplevel.Allocation.Width; int center = windowWidth / 2; int left = Math.Max (center - 300, args.Allocation.Left); int right = Math.Min (left + 600, args.Allocation.Right); uint left_padding = (uint) (left - args.Allocation.Left); uint right_padding = (uint) (args.Allocation.Right - right); if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding) statusAreaAlign.SetPadding (0, 0, (uint) left_padding, (uint) right_padding); }; matchEntry = new SearchEntry (); var searchFiles = this.matchEntry.AddMenuItem (GettextCatalog.GetString ("Search Files")); searchFiles.Activated += delegate { SetSearchCategory ("files"); }; var searchTypes = this.matchEntry.AddMenuItem (GettextCatalog.GetString ("Search Types")); searchTypes.Activated += delegate { SetSearchCategory ("type"); }; var searchMembers = this.matchEntry.AddMenuItem (GettextCatalog.GetString ("Search Members")); searchMembers.Activated += delegate { SetSearchCategory ("member"); }; matchEntry.ForceFilterButtonVisible = true; matchEntry.Entry.FocusOutEvent += delegate { matchEntry.Entry.Text = ""; }; var cmd = IdeApp.CommandService.GetCommand (Commands.NavigateTo); cmd.KeyBindingChanged += delegate { UpdateSearchEntryLabel (); }; UpdateSearchEntryLabel (); matchEntry.Ready = true; matchEntry.Visible = true; matchEntry.IsCheckMenu = true; matchEntry.Entry.ModifyBase (StateType.Normal, Style.White); matchEntry.WidthRequest = 240; matchEntry.RoundedShape = true; matchEntry.Entry.Changed += HandleSearchEntryChanged; matchEntry.Activated += (sender, e) => { var pattern = SearchPopupSearchPattern.ParsePattern (matchEntry.Entry.Text); if (pattern.Pattern == null && pattern.LineNumber > 0) { popup.Destroy (); var doc = IdeApp.Workbench.ActiveDocument; if (doc != null && doc != null) { doc.Select (); doc.Editor.Caret.Location = new Mono.TextEditor.DocumentLocation (pattern.LineNumber, pattern.Column > 0 ? pattern.Column : 1); doc.Editor.CenterToCaret (); doc.Editor.Parent.StartCaretPulseAnimation (); } return; } if (popup != null) popup.OpenFile (); }; matchEntry.Entry.KeyPressEvent += (o, args) => { if (args.Event.Key == Gdk.Key.Escape) { var doc = IdeApp.Workbench.ActiveDocument; if (doc != null) { if (popup != null) popup.Destroy (); doc.Select (); } return; } if (popup != null) { args.RetVal = popup.ProcessKey (args.Event.Key, args.Event.State); } }; IdeApp.Workbench.RootWindow.WidgetEvent += delegate(object o, WidgetEventArgs args) { if (args.Event is Gdk.EventConfigure) PositionPopup (); }; BuildToolbar (); IdeApp.CommandService.RegisterCommandBar (buttonBar); AddinManager.ExtensionChanged += delegate(object sender, ExtensionEventArgs args) { if (args.PathChanged (ToolbarExtensionPath)) BuildToolbar (); }; contentBox.PackStart (matchEntry, false, false, 0); var align = new Gtk.Alignment (0, 0, 1f, 1f); align.Show (); align.TopPadding = (uint) 5; align.LeftPadding = (uint) 9; align.RightPadding = (uint) 18; align.BottomPadding = (uint) 10; align.Add (contentBox); Add (align); SetDefaultSizes (-1, 21); UpdateCombos (); button.Clicked += HandleStartButtonClicked; IdeApp.CommandService.RegisterCommandBar (this); IdeApp.CommandService.ActiveWidgetChanged += (sender, e) => { lastCommandTarget = e.OldActiveWidget; }; this.ShowAll (); this.statusArea.statusIconBox.HideAll (); }
public PdfExportDialog(GameManager manager, ITranslations translations) : base(translations, "PdfExportDialog.ui", "pdfexportbox") { pdfExporter = new PdfExporter(translations); this.manager = manager; games_spinbutton.Value = 10; checkbox_logic.Active = checkbox_calculation.Active = checkbox_verbal.Active = true; // Use defaults from Preferences switch ((GameDifficulty)Preferences.Get <int> (Preferences.DifficultyKey)) { case GameDifficulty.Easy: rb_easy.Active = rb_easy.HasFocus = true; break; case GameDifficulty.Medium: rb_medium.Active = rb_medium.HasFocus = true; break; case GameDifficulty.Master: rb_master.Active = rb_master.HasFocus = true; break; } // File selection string def_file; def_file = System.IO.Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), // Translators: default file name used when exporting PDF files (keep the pdf extension please) Catalog.GetString("games.pdf")); file = new BrowseFile(hbox_file, def_file, true); FileFilter[] filters = new FileFilter [2]; filters[0] = new FileFilter(); filters[0].AddPattern("*.pdf"); filters[0].Name = Catalog.GetString("PDF files"); filters[1] = new FileFilter(); filters[1].AddPattern("*.*"); filters[1].Name = Catalog.GetString("All files"); file.Filters = filters; ListStore layout_store = new ListStore(typeof(string), typeof(int)); // DisplayName, index to array CellRenderer layout_cell = new CellRendererText(); layout_combo.Model = layout_store; layout_combo.PackStart(layout_cell, true); layout_combo.SetCellDataFunc(layout_cell, ComboBoxCellFunc); int [] per_side = pdfExporter.PagesPerSide; for (int i = 0; i < per_side.Length; i++) { layout_store.AppendValues(per_side[i].ToString(), per_side[i]); } // Default value TreeIter iter; bool more = layout_store.GetIterFirst(out iter); while (more) { if ((int)layout_store.GetValue(iter, COLUMN_VALUE) == DEF_SIDEVALUE) { layout_combo.SetActiveIter(iter); break; } more = layout_store.IterNext(ref iter); } }
public override Widget CreatePanelWidget () { HBox hbox = new HBox (false, 6); Label label = new Label (); label.MarkupWithMnemonic = GettextCatalog.GetString ("_Policy:"); hbox.PackStart (label, false, false, 0); store = new ListStore (typeof (string), typeof (PolicySet)); policyCombo = new ComboBox (store); CellRenderer renderer = new CellRendererText (); policyCombo.PackStart (renderer, true); policyCombo.AddAttribute (renderer, "text", 0); label.MnemonicWidget = policyCombo; policyCombo.RowSeparatorFunc = (TreeModel model, TreeIter iter) => ((string) model.GetValue (iter, 0)) == "--"; hbox.PackStart (policyCombo, false, false, 0); VBox vbox = new VBox (false, 6); vbox.PackStart (hbox, false, false, 0); vbox.ShowAll (); // Warning message to be shown when the user modifies the default policy warningMessage = new HBox (); warningMessage.Spacing = 6; Image img = new Image (Gtk.Stock.DialogWarning, IconSize.LargeToolbar); warningMessage.PackStart (img, false, false, 0); Label wl = new Label (GettextCatalog.GetString ("Changes done in this section will only be applied to new projects. " + "Settings for existing projects can be modified in the project (or solution) options dialog.")); wl.Xalign = 0; wl.Wrap = true; wl.WidthRequest = 450; warningMessage.PackStart (wl, true, true, 0); warningMessage.ShowAll (); warningMessage.Visible = false; vbox.PackEnd (warningMessage, false, false, 0); notebook = new Notebook (); // Get the panels for all mime types List<string> types = new List<string> (); types.AddRange (DesktopService.GetMimeTypeInheritanceChain (mimeType)); panelData.SectionLoaded = true; panels = panelData.Panels; foreach (IMimeTypePolicyOptionsPanel panel in panelData.Panels) { panel.SetParentSection (this); Widget child = panel.CreateMimePanelWidget (); Label tlabel = new Label (panel.Label); label.Show (); child.Show (); Alignment align = new Alignment (0.5f, 0.5f, 1f, 1f); align.BorderWidth = 6; align.Add (child); align.Show (); notebook.AppendPage (align, tlabel); panel.LoadCurrentPolicy (); } notebook.SwitchPage += delegate(object o, SwitchPageArgs args) { if (notebook.Page >= 0 && notebook.Page < this.panels.Count) this.panels[notebook.Page].PanelSelected (); }; notebook.Show (); vbox.PackEnd (notebook, true, true, 0); FillPolicies (); policyCombo.Active = 0; loading = false; if (!isRoot && panelData.UseParentPolicy) { //in this case "parent" is always first in the list policyCombo.Active = 0; notebook.Sensitive = false; } else { UpdateSelectedNamedPolicy (); } policyCombo.Changed += HandlePolicyComboChanged; return vbox; }
public StructureDatabaseView(string fileName) { this.filename = fileName; hbox = new HBox(); sqlLiteDal = new SqlLiteDal(fileName); lblTable = new Label( MainClass.Languages.Translate("tables")); hbox.PackStart(lblTable, false, false, 10); cbTable = new ComboBox(); cbTable.Changed += new EventHandler(OnComboProjectChanged); CellRendererText textRenderer = new CellRendererText(); cbTable.PackStart(textRenderer, true); cbTable.AddAttribute(textRenderer, "text", 0); cbTable.Model = tablesComboModel; cbTable.WidthRequest = 200; hbox.PackStart(cbTable, false, false, 2); hbox.PackEnd(new Label(""), true, true, 2); HButtonBox hbbAction = new HButtonBox(); hbbAction.LayoutStyle = Gtk.ButtonBoxStyle.Start; hbbAction.Spacing =6; Button btnAddTable = new Button(MainClass.Languages.Translate("add_table")); btnAddTable.Clicked+= delegate(object sender, EventArgs e) { SqlLiteAddTable addtable = new SqlLiteAddTable( filename ); int result = addtable.Run(); if (result == (int)ResponseType.Ok) { GetTables(); } addtable.Destroy(); }; Button btnDeleteTable = new Button(MainClass.Languages.Translate("delete_table")); btnDeleteTable.Clicked+= delegate(object sender, EventArgs e) { if(!CheckSelectTable()) return; MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo,MainClass.Languages.Translate("permanently_delete_table", curentTable), "", Gtk.MessageType.Question); int result = md.ShowDialog(); if (result != (int)Gtk.ResponseType.Yes) return; DropTable(); GetTables(); }; Button btnEditTable = new Button(MainClass.Languages.Translate("edit_table")); btnEditTable.Clicked+= delegate(object sender, EventArgs e) { if(!CheckSelectTable()) return; SqlLiteEditTable editTable = new SqlLiteEditTable(filename,curentTable); int result = editTable.Run(); if (result == (int)ResponseType.Ok) { GetTables(); } editTable.Destroy(); }; hbbAction.Add(btnAddTable); hbbAction.Add(btnDeleteTable); hbbAction.Add(btnEditTable); hbox.PackEnd(hbbAction, false, false, 10); this.PackStart(hbox, false, false, 5); ScrolledWindow sw = new ScrolledWindow(); sw.ShadowType = ShadowType.EtchedIn; sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); treeView = new TreeView(tableModel); GenerateColumns(); treeView.RulesHint = true; //treeView.SearchColumn = (int) Column.Description; sw.Add(treeView); this.PackStart(sw, true, true, 5); ScrolledWindow sw2 = new ScrolledWindow (); sw2.ShadowType = ShadowType.EtchedIn; sw2.SetPolicy (PolicyType.Automatic, PolicyType.Automatic); sw2.HeightRequest = 50; textControl = new TextView(); textControl.Editable = false; textControl.HeightRequest = 50; sw2.Add (textControl); this.PackEnd(sw2, false, false, 5); this.ShowAll(); GetTables(); //cbTable.Active = 0; }
public DateEdit(System.DateTime time, DateEditFlags flags) { datetime = new DateTimeZone(time); datetime.Changed += HandleDateTimeZoneChanged; this.flags = flags; date_entry = new Gtk.Entry(); date_entry.WidthChars = 10; date_entry.Changed += HandleDateEntryChanged; PackStart(date_entry, true, true, 0); Gtk.HBox b_box = new Gtk.HBox(); b_box.PackStart(new Gtk.Label(Catalog.GetString("Calendar")), true, true, 0); b_box.PackStart(new Gtk.Arrow(Gtk.ArrowType.Down, Gtk.ShadowType.Out), true, false, 0); date_button = new Gtk.Button(b_box); date_button.Clicked += HandleCalendarButtonClicked; PackStart(date_button, false, false, 0); calendar = new Gtk.Calendar(); calendar.DaySelected += HandleCalendarDaySelected; Gtk.Frame frame = new Gtk.Frame(); frame.Add(calendar); cal_popup = new Gtk.Window(Gtk.WindowType.Popup); cal_popup.DestroyWithParent = true; cal_popup.Add(frame); cal_popup.Shown += HandleCalendarPopupShown; cal_popup.GrabNotify += HandlePopupGrabNotify; frame.Show(); calendar.Show(); time_entry = new Gtk.Entry(); time_entry.WidthChars = 8; time_entry.Changed += HandleTimeEntryChanged; PackStart(time_entry, true, true, 0); Gtk.CellRendererText timecell = new Gtk.CellRendererText(); time_combo = new Gtk.ComboBox(); time_store = new Gtk.TreeStore(typeof(string), typeof(int), typeof(int)); time_combo.Model = time_store; time_combo.PackStart(timecell, true); time_combo.SetCellDataFunc(timecell, new CellLayoutDataFunc(TimeCellFunc)); time_combo.Realized += FillTimeCombo; time_combo.Changed += HandleTimeComboChanged; PackStart(time_combo, false, false, 0); zone_entry = new Gtk.Entry(); zone_entry.IsEditable = false; zone_entry.MaxLength = 6; zone_entry.WidthChars = 6; PackStart(zone_entry, true, true, 0); Gtk.CellRendererText offsetcell = new Gtk.CellRendererText(); offset_combo = new Gtk.ComboBox(); offset_combo.Model = new Gtk.TreeStore(typeof(string), typeof(int)); offset_combo.PackStart(offsetcell, true); offset_combo.SetCellDataFunc(offsetcell, new CellLayoutDataFunc(OffsetCellFunc)); FillOffsetCombo(); offset_combo.Changed += HandleOffsetComboChanged; PackStart(offset_combo, false, false, 0); Update(); ShowAll(); }
/// <summary> /// Constructor /// </summary> /// <param name="service"> /// The <see cref="StreamrecorderService"/> that is being configured /// </param> /// <param name="previous_output_folder"> /// A <see cref="System.String"/> containing the previously configured output directory /// </param> /// <param name="previous_encoder"> /// A <see cref="System.String"/> containing the previously configured encoder /// </param> /// <param name="is_importing_enabled"> /// A <see cref="System.Boolean"/> indicating whether file scanning was previously enabled /// </param> /// <param name="is_splitting_enabled"> /// A <see cref="System.Boolean"/> indicating whether file splitting was previously enabled /// </param> public StreamrecorderConfigDialog(StreamrecorderService service, string previous_output_folder, string previous_encoder, bool is_importing_enabled, bool is_splitting_enabled) { streamrecorder_service = service; encoderbox.IdColumn = 0; preferences_image.Yalign = 0f; preferences_image.IconName = "gtk-preferences"; preferences_image.IconSize = (int)IconSize.Dialog; preferences_image.Show(); header_label.Text = String.Format(AddinManager.CurrentLocalizer.GetString("{0}Streamrecorder configuration\n{1}"), "<span weight=\"bold\" size=\"larger\">", "</span>"); header_label.UseMarkup = true; header_label.Wrap = true; header_label.Yalign = 0f; header_label.Xalign = 0f; description_label.Text = AddinManager.CurrentLocalizer.GetString("Please select output folder for ripped files and if ripped\n" + "files should be imported to media library.\n"); description_label.Yalign = 0f; description_label.Xalign = 0f; choose_folder_label.Text = AddinManager.CurrentLocalizer.GetString("Output folder:"); choose_encoder_label.Text = AddinManager.CurrentLocalizer.GetString("Encoder:"); output_folder.Text = previous_output_folder; choose_output_folder_button.Label = AddinManager.CurrentLocalizer.GetString("_Browse"); choose_output_folder_button.Image = new Image("gtk-directory", IconSize.Button); choose_output_folder_button.ShowAll(); cancel_button.Label = AddinManager.CurrentLocalizer.GetString("_Cancel"); cancel_button.Image = new Image("gtk-cancel", IconSize.Button); save_button.Label = AddinManager.CurrentLocalizer.GetString("_Save"); save_button.Image = new Image("gtk-save", IconSize.Button); enable_import_ripped_songs.Label = AddinManager.CurrentLocalizer.GetString("Import files to media library"); enable_import_ripped_songs.Active = StreamrecorderService.IsImportingEnabledEntry.Get().Equals("True") ? true : false; enable_automatic_splitting.Label = AddinManager.CurrentLocalizer.GetString("Enable automatic files splitting by Metadata"); enable_automatic_splitting.Active = StreamrecorderService.IsFileSplittingEnabledEntry.Get().Equals("True") ? true : false; encoderbox.Clear(); CellRendererText cell = new CellRendererText(); encoderbox.PackStart(cell, false); encoderbox.AddAttribute(cell, "text", 0); ListStore store = new ListStore(typeof(string)); encoderbox.Model = store; int row = -1; int chosen_row = -1; foreach (string encoder in streamrecorder_service.GetEncoders()) { row++; store.AppendValues(encoder); if (encoder.Equals(previous_encoder)) { chosen_row = row; Hyena.Log.DebugFormat("[StreamrecorderConfigDialog] found active encoder in row {1}: {0}", encoder, chosen_row); } } if (chosen_row > -1) { Gtk.TreeIter iter; encoderbox.Model.IterNthChild(out iter, chosen_row); encoderbox.SetActiveIter(iter); } else { Gtk.TreeIter iter; encoderbox.Model.GetIterFirst(out iter); encoderbox.SetActiveIter(iter); } HBox main_container = new HBox(); VBox action_container = new VBox(); main_container.Spacing = 12; main_container.BorderWidth = 6; action_container.PackStart(header_label, true, true, 0); action_container.PackStart(description_label, true, true, 0); VBox choosing_labels = new VBox(); choosing_labels.PackStart(choose_folder_label, true, true, 5); choosing_labels.PackStart(choose_encoder_label, true, true, 5); HBox folder_choosing = new HBox(); folder_choosing.PackStart(output_folder, true, true, 5); folder_choosing.PackStart(choose_output_folder_button, true, true, 0); VBox box_choosing = new VBox(); box_choosing.PackStart(folder_choosing, true, true, 0); box_choosing.PackStart(encoderbox, true, true, 5); HBox all_choosing = new HBox(); all_choosing.PackStart(choosing_labels, true, true, 0); all_choosing.PackStart(box_choosing, true, true, 0); action_container.PackStart(all_choosing, true, true, 5); action_container.PackStart(enable_automatic_splitting, true, true, 5); action_container.PackStart(enable_import_ripped_songs, true, true, 5); main_container.PackStart(preferences_image, true, true, 5); main_container.PackEnd(action_container, true, true, 5); this.ContentArea.PackStart(main_container, true, true, 5); AddActionWidget(cancel_button, 0); AddActionWidget(save_button, 0); choose_output_folder_button.Clicked += new EventHandler(OnChooseOutputFolderButtonClicked); cancel_button.Clicked += new EventHandler(OnCancelButtonClicked); save_button.Clicked += new EventHandler(OnSaveButtonClicked); Title = "Streamrecorder configuration"; IconName = "gtk-preferences"; Resizable = false; BorderWidth = 6; // HasSeparator = false; this.ContentArea.Spacing = 12; ShowAll(); }
public override Widget CreatePanelWidget () { HBox hbox = new HBox (false, 6); Label label = new Label (); label.MarkupWithMnemonic = GettextCatalog.GetString ("_Policy:"); hbox.PackStart (label, false, false, 0); store = new ListStore (typeof (string), typeof (PolicySet)); policyCombo = new ComboBox (store); CellRenderer renderer = new CellRendererText (); policyCombo.PackStart (renderer, true); policyCombo.AddAttribute (renderer, "text", 0); label.MnemonicWidget = policyCombo; policyCombo.RowSeparatorFunc = (TreeModel model, TreeIter iter) => ((string) model.GetValue (iter, 0)) == "--"; hbox.PackStart (policyCombo, false, false, 0); VBox vbox = new VBox (false, 6); vbox.PackStart (hbox, false, false, 0); vbox.ShowAll (); notebook = new Notebook (); // Get the panels for all mime types List<string> types = new List<string> (); types.AddRange (DesktopService.GetMimeTypeInheritanceChain (mimeType)); panelData.SectionLoaded = true; panels = panelData.Panels; foreach (IMimeTypePolicyOptionsPanel panel in panelData.Panels) { panel.SetParentSection (this); Widget child = panel.CreateMimePanelWidget (); Label tlabel = new Label (panel.Label); label.Show (); child.Show (); Alignment align = new Alignment (0.5f, 0.5f, 1f, 1f); align.BorderWidth = 6; align.Add (child); align.Show (); notebook.AppendPage (align, tlabel); panel.LoadCurrentPolicy (); } notebook.Show (); vbox.PackEnd (notebook, true, true, 0); FillPolicies (); policyCombo.Active = 0; loading = false; if (!isRoot && panelData.UseParentPolicy) { //in this case "parent" is always first in the list policyCombo.Active = 0; notebook.Sensitive = false; } else { UpdateSelectedNamedPolicy (); } policyCombo.Changed += HandlePolicyComboChanged; return vbox; }
public requisicion_materiales_compras(string LoginEmp_, string NomEmpleado_, string AppEmpleado_, string ApmEmpleado_, string _nombrebd_) { LoginEmpleado = LoginEmp_; NomEmpleado = NomEmpleado_; AppEmpleado = AppEmpleado_; ApmEmpleado = ApmEmpleado_; nombrebd = _nombrebd_; Glade.XML gxml = new Glade.XML(null, "almacen_costos_compras.glade", "requisicion_materiales", null); gxml.Autoconnect(this); ////// Muestra ventana de Glade requisicion_materiales.Show(); // Creacion de una Nueva Requisicion entry_requisicion.KeyPressEvent += onKeyPressEvent_enter_requisicion; checkbutton_nueva_requisicion.Clicked += new EventHandler(on_checkbutton_nueva_requisicion_clicked); // Asignando valores de Fechas this.entry_fecha_solicitud.Text = (string)DateTime.Now.ToString("yyyy-MM-dd"); this.entry_fecha_requerida.Text = (string)DateTime.Now.ToString("yyyy-MM-dd"); // Llenado de combobox1 combobox_tipo_admision.Clear(); CellRendererText cell1 = new CellRendererText(); combobox_tipo_admision.PackStart(cell1, true); combobox_tipo_admision.AddAttribute(cell1, "text", 0); combobox_tipo_admision2.Clear(); CellRendererText cell2 = new CellRendererText(); combobox_tipo_admision2.PackStart(cell2, true); combobox_tipo_admision2.AddAttribute(cell2, "text", 0); ListStore store2 = new ListStore(typeof(string), typeof(int)); combobox_tipo_admision.Model = store2; combobox_tipo_admision2.Model = store2; // lleno de la tabla de his_tipo_de_admisiones NpgsqlConnection conexion; conexion = new NpgsqlConnection(connectionString + nombrebd); // Verifica que la base de datos este conectada try{ conexion.Open(); NpgsqlCommand comando; comando = conexion.CreateCommand(); comando.CommandText = "SELECT * FROM hscmty_his_tipo_admisiones " + //"WHERE cuenta_mayor = 4000 "+ " ORDER BY descripcion_admisiones;"; NpgsqlDataReader lector = comando.ExecuteReader(); while (lector.Read()) { store2.AppendValues((string)lector["descripcion_admisiones"], (int)lector["id_tipo_admisiones"]); } }catch (NpgsqlException ex) { MessageDialog msgBoxError = new MessageDialog(MyWinError, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, "PostgresSQL error: {0}", ex.Message); msgBoxError.Run(); msgBoxError.Destroy(); } conexion.Close(); TreeIter iter2; if (store2.GetIterFirst(out iter2)) { //Console.WriteLine(iter2); combobox_tipo_admision.SetActiveIter(iter2); } combobox_tipo_admision.Changed += new EventHandler(onComboBoxChanged_tipo_admision); combobox_tipo_admision2.Changed += new EventHandler(onComboBoxChanged_tipo_admision2); // Sale de la ventana button_salir.Clicked += new EventHandler(on_cierraventanas_clicked); // Activacion de boton de busqueda button_busca_producto.Clicked += new EventHandler(on_button_busca_producto_clicked); // Desactivando Entrys y Combobox this.entry_fecha_solicitud.Sensitive = false; this.entry_fecha_requerida.Sensitive = false; this.combobox_tipo_admision.Sensitive = false; this.combobox_tipo_admision2.Sensitive = false; this.entry_observaciones.Sensitive = false; this.button_guardar_requisicion.Sensitive = false; statusbar_almacen_requi.Pop(0); statusbar_almacen_requi.Push(1, "login: "******" |Usuario: " + NomEmpleado + " " + AppEmpleado + " " + ApmEmpleado); statusbar_almacen_requi.HasResizeGrip = false; // Creacion del treeview crea_treeview_requisicion(); }
public FilterWidgetRow(FileSearchFilter filter) : base(0, 0, 1, 1) { TreeIter iter; CellRendererText textCell; ListStore store; this.filter = filter; matchTypeStore = new ListStore(typeof(string), typeof(FileSearchFilterComparison)); textCell = new CellRendererText(); matchTypeComboBox = new ComboBox(); matchTypeComboBox.Model = matchTypeStore; matchTypeComboBox.PackStart(textCell, true); matchTypeComboBox.AddAttribute(textCell, "text", 0); matchTypeComboBox.RowSeparatorFunc = ComboSeparatorFunc; matchTypeComboBox.Changed += MatchTypeChanged; textCell = new CellRendererText(); store = new ListStore(typeof(string), typeof(FilterEntryMode), typeof(FileSearchFilterField)); filterTextEntry = new FilterEntry(filter); filterTextEntry.Changed += FilterTextChanged; fieldComboBox = new ComboBox(); fieldComboBox.PackStart(textCell, true); fieldComboBox.AddAttribute(textCell, "text", 0); fieldComboBox.SetCellDataFunc(textCell, FieldComboDataFunc); store.AppendValues("File Name", FilterEntryMode.String, FileSearchFilterField.FileName); store.AppendValues("Size", FilterEntryMode.Size, FileSearchFilterField.Size); store.AppendValues("-"); store.AppendValues("(Audio)", null); store.AppendValues("Artist", FilterEntryMode.String, FileSearchFilterField.Artist); store.AppendValues("Album", FilterEntryMode.String, FileSearchFilterField.Album); store.AppendValues("Bitrate", FilterEntryMode.Speed, FileSearchFilterField.Bitrate); store.AppendValues("-"); store.AppendValues("(Video)", null); store.AppendValues("Resolution", FilterEntryMode.Dimentions, FileSearchFilterField.Resolution); store.AppendValues("-"); store.AppendValues("(Images)", null); store.AppendValues("Dimentions", FilterEntryMode.Dimentions, FileSearchFilterField.Dimentions); fieldComboBox.Model = store; fieldComboBox.RowSeparatorFunc = ComboSeparatorFunc; fieldComboBox.Changed += FieldChanged; /* if (fieldComboBox.Model.GetIterFirst(out iter)) { fieldComboBox.SetActiveIter(iter); } */ addButton = new Button(); addButton.Relief = ReliefStyle.None; addButton.Image = new Image(Gui.LoadIcon(16, "list-add")); addButton.Clicked += AddButtonClicked; removeButton = new Button(); removeButton.Relief = ReliefStyle.None; removeButton.Image = new Image(Gui.LoadIcon(16, "list-remove")); removeButton.Clicked += RemoveButtonClicked; box = new HBox(); box.PackStart(fieldComboBox, false, false, 0); box.PackStart(matchTypeComboBox, false, false, 3); box.PackStart(filterTextEntry, true, true, 0); box.PackStart(removeButton, false, false, 0); box.PackStart(addButton, false, false, 0); this.TopPadding = 3; this.BottomPadding = 3; this.Add(box); fieldComboBox.Model.GetIterFirst(out iter); do { FileSearchFilterField field = (FileSearchFilterField)fieldComboBox.Model.GetValue(iter, 2); if (field == filter.Field) { fieldComboBox.SetActiveIter(iter); break; } } while (fieldComboBox.Model.IterNext(ref iter)); matchTypeComboBox.Model.GetIterFirst(out iter); do { FileSearchFilterComparison comp = (FileSearchFilterComparison)matchTypeComboBox.Model.GetValue(iter, 1); if (comp == filter.Comparison) { matchTypeComboBox.SetActiveIter(iter); break; } } while (matchTypeComboBox.Model.IterNext(ref iter)); filterTextEntry.Text = filter.Text; }
private void GenerateContent(ref Gtk.Table tableSystem, string label, int xPos, Condition cd,bool isResolution) { ListStore lstorePlatform = new ListStore(typeof(int),typeof(int),typeof(string)); int selectRule = 0; if (conditionRules_Old.Count > 0) { ConditionRule cr = conditionRules_Old.Find(x => x.ConditionId == cd.Id); if (cr != null) selectRule = cr.RuleId; } Label lblPlatform = new Label(label); lblPlatform.Name = "lbl_" + label; lblPlatform.Xalign = 1; lblPlatform.Yalign = 0.5F; ComboBox cboxPlatform = new ComboBox(); cboxPlatform.Name = "cd_" + label; CellRendererText textRenderer = new CellRendererText(); cboxPlatform.PackStart(textRenderer, true); cboxPlatform.AddAttribute(textRenderer, "text", 2); cboxPlatform.WidthRequest = 200; cboxPlatform.Model = lstorePlatform; cboxPlatform.Changed += delegate(object sender, EventArgs e) { if (sender == null) return; ComboBox combo = sender as ComboBox; TreeIter iter; if (combo.GetActiveIter(out iter)) { int ruleId = (int)combo.Model.GetValue(iter, 0); int condId = (int)combo.Model.GetValue(iter, 1); if (ruleId != 0){ ConditionRule cr = conditionRules.Find(x => x.ConditionId == condId);//cd.Id); if (cr != null) cr.RuleId = ruleId; else conditionRules.Add(new ConditionRule(condId,ruleId)); } else { ConditionRule cr = conditionRules.Find(x => x.ConditionId == condId);//cd.Id); if (cr != null){ conditionRules.Remove(cr); } } } }; tableSystem.Attach(lblPlatform, 0, 1, (uint)(xPos - 1), (uint)xPos, AttachOptions.Shrink, AttachOptions.Shrink, 2, 2); tableSystem.Attach(cboxPlatform, 1, 2, (uint)(xPos - 1), (uint)xPos, AttachOptions.Shrink, AttachOptions.Shrink, 2, 2); TreeIter selectIter = lstorePlatform.AppendValues(0, cd.Id, "Unset"); foreach (Rule rl in cd.Rules){ if(!isResolution){ if (rl.Id == selectRule) selectIter = lstorePlatform.AppendValues(rl.Id, cd.Id, rl.Name); else lstorePlatform.AppendValues(rl.Id, cd.Id, rl.Name); } else { string name = String.Format("{0} ({1}x{2})",rl.Name,rl.Width,rl.Height); if (rl.Id == selectRule) selectIter = lstorePlatform.AppendValues(rl.Id, cd.Id, name); else lstorePlatform.AppendValues(rl.Id, cd.Id, name); } } cboxPlatform.SetActiveIter(selectIter); }