private void restore() { restoring = true; txtMain.Text = oldText; txtMain.SelectAll(); restoring = false; }
public RadioEditPanel(RadioStation Station, string[] GenreList, Radio.StationEditComplete Callback) : base() { SPACING = 8; station = Station; callback = Callback; lblName = new QLabel("&Name"); lblName.ShowAccellerator(); this.Controls.Add(lblName); lblGenre = new QLabel("&Genre"); lblGenre.ShowAccellerator(); this.Controls.Add(lblGenre); lblBitRate = new QLabel("&Bit Rate"); lblBitRate.ShowAccellerator(); this.Controls.Add(lblBitRate); lblStreamType = new QLabel("&Stream Type"); lblStreamType.ShowAccellerator(); this.Controls.Add(lblStreamType); lblURL = new QLabel("&URL"); lblURL.ShowAccellerator(); this.Controls.Add(lblURL); txtName = new QTextBox(); txtName.Width = 1000; txtName.MaxLength = 140; txtName.GotFocus += (s, e) => txtName.SelectAll(); this.Controls.Add(txtName); cboGenre = new QComboBox(true); cboGenre.MaxLength = 30; cboGenre.Items.AddRange(GenreList); this.Controls.Add(cboGenre); txtBitrate = new QTextBox(); txtBitrate.NumericOnly = true; txtBitrate.MaxLength = 3; this.Controls.Add(txtBitrate); cboStreamType = new QComboBox(false); cboStreamType.Items.AddRange(RadioStation.StreamTypeArray); this.Controls.Add(cboStreamType); txtURL = new QTextBox(); txtURL.MaxLength = 2048; this.Controls.Add(txtURL); txtName.Text = station.Name; cboGenre.Text = station.Genre; if (station.BitRate > 0) { txtBitrate.Text = station.BitRate.ToString(); } else { txtBitrate.Text = String.Empty; } cboStreamType.SelectedIndex = (int)station.StreamType; txtURL.Text = station.URL; btnOK = new QButton(Localization.OK, false, false); AddButton(btnOK, ok); btnCancel = new QButton(Localization.CANCEL, false, false); AddButton(btnCancel, cancel); resize(); this.ClientSize = new Size(this.ClientRectangle.Width, btnOK.Bottom + MARGIN); int tabIndex = 0; lblName.TabIndex = tabIndex++; txtName.TabIndex = tabIndex++; lblGenre.TabIndex = tabIndex++; cboGenre.TabIndex = tabIndex++; lblURL.TabIndex = tabIndex++; txtURL.TabIndex = tabIndex++; lblBitRate.TabIndex = tabIndex++; txtBitrate.TabIndex = tabIndex++; lblStreamType.TabIndex = tabIndex++; cboStreamType.TabIndex = tabIndex++; btnOK.TabIndex = tabIndex++; btnCancel.TabIndex = tabIndex++; setWrapAroundTabControl(tabIndex, txtName, null); initialized = true; }