void radiobutton_StateChange(object sender, Toolbox.RadioButton.StateChangeEventArgs e) { // We're using the same handler for two buttons, so use the sender object to determine which // one we've been called for. Toolbox.RadioButton button = (Toolbox.RadioButton)sender; Reporter.WriteLine("RadioButton {0} returned StateChange event.", button.Label); Reporter.WriteLine("New state is {0}.", e.NewState); Reporter.WriteLine("Mouse {0} button was used to change the state.", e.Select ? "Select" : "Adjust"); Reporter.WriteLine("Previously selected radio button was {0}.", e.Previous.Label); Reporter.WriteLine(""); }
public Dialogue(uint objID) : base(objID) { Title = "C# Dialogue Box"; GainCaret += gain_caret; OKButton = new Toolbox.ActionButton(this, CmpID.OKButton); OKButton.Text = "OK"; OKButton.Faded = true; CancelButton = new Toolbox.ActionButton(this, CmpID.CancelButton); CancelButton.Text = "Cancel"; CancelButton.HelpMessage = "Help text set in CSharp"; CancelButton.Click += cancelbtn_Click; DisplayField = new Toolbox.DisplayField(this, CmpID.DisplayField); DisplayField.Value = String.Format("{0:D}", DateTime.Now); DisplayField.SetFont("Trinity.Bold.Italic", 12 << 4, 12 << 4); WritableField = new Toolbox.WritableField(this, CmpID.WritableField); WritableField.Value = "CSharp"; WritableField.Allowable = "A-Za-z0-9 "; WritableField.SetFont("Trinity.Medium.Italic", 12 << 4, 12 << 4); WritableField.ValueChange += writable_ValueChange; NumberRange = new Toolbox.NumberRange(this, CmpID.NumberRange); NumberRange.Value = 1999; NumberRange.ValueChange += numberrange_ValueChange; StringSet = new Toolbox.StringSet(this, CmpID.StringSet); StringSet.Available = "One,Two,Three,Four,Five"; StringSet.SelectedString = "Three"; StringSet.ValueChange += stringset_ValueChange; StringSet.AboutToBeShown += stringset_AboutToBeShown; OptionButton = new Toolbox.OptionButton(this, CmpID.OptionButton); OptionButton.Label = "Sugar"; OptionButton.CurrentState = Toolbox.OptionButton.State.On; OptionButton.StateChange += optionbutton_StateChange; Radio1 = new Toolbox.RadioButton(this, CmpID.Radio1); Radio1.Label = "Coffee"; Radio1.StateChange += radiobutton_StateChange; Radio2 = new Toolbox.RadioButton(this, CmpID.Radio2); Radio2.Label = "Tea"; Radio2.CurrentState = Toolbox.RadioButton.State.On; Radio2.StateChange += radiobutton_StateChange; Slider = new Toolbox.Slider(this, CmpID.Slider); Slider.UpperBound = 1000; Slider.LowerBound = 100; Slider.StepSize = 20; Slider.Value = 200; Slider.SetColour(OS.DesktopColour.Red, OS.DesktopColour.Cream); Slider.ValueChange += slider_ValueChange; Draggable = new Toolbox.Draggable(this, CmpID.Draggable); Draggable.Text = "Sprites"; Draggable.Sprite = "file_ff9"; Draggable.DragStart += draggable_DragStart; Draggable.DragEnd += draggable_DragEnd; Button = new Toolbox.Button(this, CmpID.Button); PopupMenu = new Toolbox.PopupMenu(this, CmpID.PopupMenu); // PopupMenu.Menu = task.main_menu; PopupMenu.AboutToBeShown += popupmenu_Show; AdjusterArrow = new Toolbox.AdjusterArrow(this, CmpID.AdjusterArrow); AdjusterArrow.Click += adjusterarrow_Click; }