private void AddPropertyCombobox(string idPostfix, string defValue) { Assert.ArgumentNotNull(idPostfix, "idPostfix"); var editableCombobox1 = new EditableCombobox(); editableCombobox1.ID = "Property" + idPostfix; editableCombobox1.SelectOnly = true; editableCombobox1.List = PropertyList; var editableCombobox2 = editableCombobox1; if (string.IsNullOrEmpty(defValue)) { editableCombobox2.Value = HttpUtility.HtmlEncode(FormatDefaultText(Translate.Text("select property"))); } else { foreach (var str in PropertyList) { if (defValue.Equals(str, StringComparison.OrdinalIgnoreCase)) { editableCombobox2.Value = str; break; } } } ParentControl.Controls.Add(editableCombobox2); }
static void Main(string[] args) { Application.Init(); Menu fM = new Menu("File"); CheckableMenuItem nI = fM.AppendCheckableItem("Hello world", true); MenuItem qI = fM.AppendQuitItem(); Window w = new Window("Hello world", 300, 300, true); Button b = new Button("Increment me"); s = new Slider(0, 100); n = new Spinbox(0, 100); p = new ProgressBar(); Checkbox c = new Checkbox("Error"); ColorButton cb = new ColorButton(); EditableCombobox m = new EditableCombobox(); m.Text = w.Title; VBox x = new VBox(); b.Clicked += (o, e) => { val++; ApplyValues(val); }; EventHandler <EventArgs> handle = (o, e) => { var v = ((INumInput)o).Value; ApplyValues(v); }; n.Changed += handle; s.Changed += handle; cb.Changed += (o, e) => { w.MessageBox("Color", String.Format("{0} {1} {2} {3}", cb.Color.R, cb.Color.G, cb.Color.B, cb.Color.A)); }; nI.Clicked += (o, e) => { w.MessageBox("result", nI.Checked.ToString()); }; w.Closing += (o, e) => { w.MessageBox("Bye!", "See you later", c.Checked); w.Destroy(); Application.Quit(); }; w.Margins = 5; w.Child = x; x.Padding = 5; x.Append(b); x.Append(s); x.Append(n); x.Append(p); x.Append(c); x.Append(cb); x.Append(m); w.Visible = true; Application.Main(); Application.Finish(); }