void LogEvents(TextBox control) { control.TextChanged += delegate { Log.Write(control, "TextChanged, Text: {0}", control.Text); }; }
public NetworkDatabaseSettings(NetworkDatabaseProcess process) { _process = process; _name = new TextBox(); _name.Bind( tb => tb.Text, _process, proc => proc.Name, DualBindingMode.TwoWay); _processId = new NumericUpDown(); _processId.Bind( nud => nud.Value, _process, proc => proc.ProcessId, DualBindingMode.TwoWay); _databasePath = new TextBox(); _databasePath.Bind( tb => tb.Text, _process, proc => proc.DatabasePath, DualBindingMode.TwoWay); this.AddRow(new Label() { Text = Constants.ProcessNameLabel }, _name); this.AddRow(new Label() { Text = Constants.ProcessIdLabel }, _processId); this.AddRow(); }
void Init() { //_textBoxUrl _textBoxUrl = new TextBox(); //_buttonReadFile _buttonReadFile = new Button { Text = StrRes.GetString("StrLoad", "Load") }; _buttonReadFile.Click += _buttonReadFile_Click; //_buttonSaveFile _buttonSaveFile = new Button {Text = StrRes.GetString("StrSave","Save")}; _buttonSaveFile.Click += _buttonSaveFile_Click; //_textAreaBody _textAreaBody = new TextArea(); var layout = new DynamicLayout { Padding = new Padding(5, 5), Spacing = new Size(5, 5) }; layout.BeginVertical(); layout.BeginHorizontal(); layout.AddCentered(_textBoxUrl, xscale: true, horizontalCenter: false); layout.AddCentered(_buttonReadFile, horizontalCenter: false); layout.AddCentered(_buttonSaveFile, horizontalCenter: false); layout.EndBeginHorizontal(); layout.EndVertical(); layout.AddRow(_textAreaBody); Content = layout; }
Control CaptionBox() { var control = new TextBox { Size = new Size(300, -1) }; var binding = new ObjectBinding<MessageBoxSection, string>(this, r => r.MessageBoxCaption, (r, val) => r.MessageBoxCaption = val); control.TextBinding.Bind(binding); return control; }
public RpcServerSettingsManager(string title, string rpcUrlHost, ushort rpcUrlPort, bool isProcessHostedLocally) { Text = title; TextBoxRpcUrlHost = new TextBox { Text = rpcUrlHost }; CheckBoxIsProcessHostedLocally = new CheckBox { Text = Desktop.Properties.Resources.OptionsNetworkIsProcessHostedLocally, Checked = isProcessHostedLocally }; RpcUrlPort = rpcUrlPort; Content = new TableLayout( new TableLayout( new TableRow( new Label { Text = Desktop.Properties.Resources.TextHost }, new TableCell(TextBoxRpcUrlHost, true), new Separator(SeparatorOrientation.Vertical), new Label { Text = Desktop.Properties.Resources.TextPort }, Utilities.CreateNumericUpDown(this, o => o.RpcUrlPort, 0, 1, ushort.MaxValue) ) ) { Spacing = Utilities.Spacing3 }, new TableRow(CheckBoxIsProcessHostedLocally) ) { Padding = new Padding(Utilities.Padding2), Spacing = Utilities.Spacing3 }; }
public ForeignDevicePortSettings(ForeignDevicePortProcess process) { _process = process; _name = new TextBox(); _name.Bind( tb => tb.Text, _process, proc => proc.Name, DualBindingMode.TwoWay); _processId = new NumericUpDown(); _processId.Bind( nud => nud.Value, _process, proc => proc.ProcessId, DualBindingMode.TwoWay); _localHost = new TextBox(); _localHost.Bind( tb => tb.Text, _process, proc => proc.LocalHost, DualBindingMode.TwoWay); _localPort = new NumericUpDown(); _localPort.Bind( nud => nud.Value, _process, proc => proc.LocalPort, DualBindingMode.TwoWay); _bbmdHost = new TextBox(); _bbmdHost.Bind( tb => tb.Text, _process, proc => proc.BbmdHost, DualBindingMode.TwoWay); _bbmdPort = new NumericUpDown(); _bbmdPort.Bind( nud => nud.Value, _process, proc => proc.BbmdPort, DualBindingMode.TwoWay); this.BeginVertical(); this.AddRow(new Label() { Text = Constants.ProcessNameLabel }, _name); this.AddRow(new Label() { Text = Constants.ProcessIdLabel }, _processId); this.EndVertical(); this.BeginVertical(); this.AddRow(new Label() { Text = Constants.LocalHostLabel }, _localHost, new Label() { Text = Constants.LocalPortLabel }, _localPort); this.AddRow(new Label() { Text = Constants.BbmdHostLabel }, _bbmdHost, new Label() { Text = Constants.BbmdPortLabel }, _bbmdPort); this.EndVertical(); this.AddRow(); }
void Init() { _tbxShellData = new TextArea {Size = new Size(-1, 200)}; _tbxMsg = new TextBox(); _btnShowMsgInStatus = new Button {Text = "Show Msg In Status", Width = 150}; _btnShowMsgInStatus.Click+=btn_showMsgInStatus_Click; _btnShowMessageBox = new Button { Text = "Show Msg In Message", Width = 150 }; _btnShowMessageBox.Click+=btn_showMessageBox_Click; _btnCreateNewTabPage = new Button { Text = "Create New TabPage", Width = 150 }; _btnCreateNewTabPage.Click+=btn_createNewTabPage_Click; // Test var btnTest = new Button {Text = "Test", Width = 150}; btnTest.Click += btnTest_Click; var layout = new DynamicLayout {Padding = new Padding(10, 10), Size = new Size(10, 10)}; layout.AddRow(new Label() { Text = "ShellData"}); layout.AddRow(_tbxShellData); layout.AddSeparateRow(new Label() { Text = "Msg", VerticalAlign = VerticalAlign.Middle }, _tbxMsg, null); layout.AddAutoSized(_btnShowMsgInStatus); layout.AddAutoSized(_btnShowMessageBox); layout.AddAutoSized(_btnCreateNewTabPage); layout.AddAutoSized(btnTest); layout.Add(null); this.Content = layout; }
public EthernetPortSettings(EthernetPortProcess process) { _process = process; _name = new TextBox(); _name.Bind( tb => tb.Text, _process, proc => proc.Name, DualBindingMode.TwoWay); _processId = new NumericUpDown(); _processId.Bind( nud => nud.Value, _process, proc => proc.ProcessId, DualBindingMode.TwoWay); _deviceName = new ComboBox(); _deviceName.DataStore = LibPcapLiveDeviceList.Instance.Where(dev => dev.Interface != null); _deviceName.KeyBinding = new PropertyBinding<string>("Name"); _deviceName.TextBinding = new PropertyBinding<string>("Description"); _deviceName.SelectedValueChanged += _deviceNameChanged; this.BeginVertical(); this.AddRow(new Label() { Text = Constants.ProcessNameLabel }, _name); this.AddRow(new Label() { Text = Constants.ProcessIdLabel }, _processId); this.AddRow(new Label() { Text = Constants.DeviceNameLabel }, _deviceName); this.EndVertical(); this.AddRow(); }
TextBox DirectBinding() { var textBox = new TextBox(); // bind to the text property using delegates textBox.TextBinding.Bind(() => "some value", val => Debug.WriteLine(string.Format("Set value to {0} directly", val))); return textBox; }
void Init() { // radioButton_noProxy _radioButtonNoProxy = new RadioButton() { Text = AltStrRes.NotUseProxy }; _radioButtonNoProxy.CheckedChanged += delegate { if (_radioButtonNoProxy.Checked) { _groupBoxSetting.Enabled = false; } }; // radioButton_ieProxy _radioButtonIeProxy = new RadioButton(_radioButtonNoProxy) { Text = AltStrRes.UseSystemProxySetting }; _radioButtonIeProxy.CheckedChanged += delegate { if (_radioButtonIeProxy.Checked) { _groupBoxSetting.Enabled = false; } }; // radioButton_customProxy _radioButtonCustomProxy = new RadioButton(_radioButtonNoProxy) { Text = AltStrRes.UseCustomProxySetting }; _radioButtonCustomProxy.CheckedChanged += delegate { if (_radioButtonCustomProxy.Checked) { _groupBoxSetting.Enabled = true; } }; // textBox _textBoxProxyAddr = new TextBox(); _textBoxProxyPort = new TextBox(); _textBoxProxyUser = new TextBox(); _textBoxProxyPasswd = new TextBox(); _textBoxProxyDomain = new TextBox(); var proxysetting = new DynamicLayout { Padding = new Padding(20, 10), Spacing = new Size(5, 5) }; proxysetting.AddRow(new Label { Text = "Server: ", VerticalAlign = VerticalAlign.Middle}, TableLayout.AutoSized(_textBoxProxyAddr)); proxysetting.AddRow(new Label { Text = "Port: ", VerticalAlign = VerticalAlign.Middle }, TableLayout.AutoSized(_textBoxProxyPort)); proxysetting.AddRow(new Label { Text = "User: "******"Passwd: ", VerticalAlign = VerticalAlign.Middle }, TableLayout.AutoSized(_textBoxProxyPasswd)); proxysetting.AddRow(new Label { Text = "Domain: ", VerticalAlign = VerticalAlign.Middle }, TableLayout.AutoSized(_textBoxProxyDomain)); _groupBoxSetting = new GroupBox {Text = AltStrRes.Setting, Content = proxysetting}; var layout = new DynamicLayout { Padding = new Padding(20, 20), Spacing = new Size(10, 10) }; layout.AddRow(_radioButtonNoProxy); layout.AddRow(_radioButtonIeProxy); layout.AddRow(_radioButtonCustomProxy); layout.AddRow(_groupBoxSetting); layout.AddRow(null); this.Content = layout; }
TextBox ObjectBinding() { // object instance we want to bind to var obj = new MyObject { TextProperty = "Initial value 2" }; var textBox = new TextBox(); // bind to the text property of a specific object instance using reflection textBox.TextBinding.Bind(obj, r => r.TextProperty); return textBox; }
public HiSumDisplay() { // sets the client (inner) size of the window for your content ClientSize = new Eto.Drawing.Size(600, 400); Title = "HiSum"; TreeGridView view = new TreeGridView(){Height = 500}; view.Columns.Add(new GridColumn() { HeaderText = "Summary", DataCell = new TextBoxCell(0), AutoSize = true, Resizable = true, Editable = false }); var textbox = new TextBox() {Width = 1000}; var button = new Button(){Text = "Go", Width = 15}; var label = new Label() {Width = 100}; var tbResult = new TextArea() {Width = 1000}; button.Click += (sender, e) => { Reader reader = new Reader(); List<int> top100 = reader.GetTop100(); List<FullStory> fullStories = new List<FullStory>(); foreach (int storyID in top100.Take(30)) { FullStory fullStory = reader.GetStoryFull(storyID); fullStories.Add(fullStory); } TreeGridItemCollection data = GetTree(fullStories); view.DataStore = data; }; Content = new TableLayout { Spacing = new Size(5, 5), // space between each cell Padding = new Padding(10, 10, 10, 10), // space around the table's sides Rows = { new TableRow( new Label{Text = "Input URL from Hacker News: ",Width=200}, textbox, button, label ), new TableRow( null, tbResult, null, null ), new TableRow( new Label(), view ), // by default, the last row & column will get scaled. This adds a row at the end to take the extra space of the form. // otherwise, the above row will get scaled and stretch the TextBox/ComboBox/CheckBox to fill the remaining height. new TableRow { ScaleHeight = true } } }; }
TextBox DataContextBinding() { var textBox = new TextBox(); // bind to the text property using delegates textBox.TextBinding.BindDataContext<MyObject>(r => r.TextProperty, (r, val) => r.TextProperty = val); // You can also bind using reflection //textBox.TextBinding.BindDataContext<MyObject>(r => r.TextProperty); // or, if the data context type is unknown //textBox.TextBinding.BindDataContext(new PropertyBinding<string>("TextProperty")); return textBox; }
Control Default() { var control = new TextBox { Text = "Some Text" }; LogEvents(control); var selectAll = new Button { Text = "Select All" }; selectAll.Click += (sender, e) => control.SelectAll(); var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5) }; layout.Add(control); layout.AddSeparateRow(null, selectAll, null); return layout; }
public SessionSettings(Session session) { _session = session; _name = new TextBox(); _name.Bind( tb => tb.Text, _session, sess => sess.Name, DualBindingMode.TwoWay); this.AddRow(new Label() { Text = Constants.SessionNameLabel }, _name); this.AddRow(); }
Control Default() { var control = new TextBox { Text = "Some Text" }; LogEvents(control); var selectAll = new Button { Text = "Select All" }; selectAll.Click += (object sender, EventArgs e) => { control.SelectAll(); }; var layout = new DynamicLayout(Padding.Empty); layout.Add(control); layout.AddSeparateRow(null, selectAll, null); return layout; }
static Control SetBadgeLabel() { var layout = new DynamicLayout { Spacing = new Size(5, 5) }; layout.BeginHorizontal(); var text = new TextBox(); var button = new Button { Text = "Set Badge Label" }; button.Click += (sender, e) => Application.Instance.BadgeLabel = text.Text; layout.Add(new Label { Text = "Badge Label Text:", VerticalAlignment = VerticalAlignment.Center }); layout.AddCentered(text); layout.Add(button); layout.EndHorizontal(); return layout; }
private Control GetDataControl(string value, bool multiline = false) { TextControl ctl; if (multiline) { var txt = new TextArea { ReadOnly = true }; txt.Wrap = true; ctl = txt; } else { var txt = new TextBox { ReadOnly = true }; ctl = txt; } ctl.Text = value; return ctl; }
public RouterSettings(RouterProcess process) { _process = process; _name = new TextBox(); _name.Bind( tb => tb.Text, _process, proc => proc.Name, DualBindingMode.TwoWay); _processId = new NumericUpDown(); _processId.Bind( nud => nud.Value, _process, proc => proc.ProcessId, DualBindingMode.TwoWay); this.BeginVertical(); this.AddRow(new Label() { Text = Constants.ProcessNameLabel }, _name); this.AddRow(new Label() { Text = Constants.ProcessIdLabel }, _processId); this.EndVertical(); GridView gv = new GridView(); gv.DataStore = process.PortMappings; gv.Columns.Add(new GridColumn() { HeaderText = "Port Id", DataCell = new TextBoxCell("PortId"), Editable = true }); gv.Columns.Add(new GridColumn() { HeaderText = "Network Number", DataCell = new TextBoxCell("Network"), Editable = true }); this.BeginVertical(); this.AddRow(gv); this.EndVertical(); this.AddRow(); }
Control SetBadgeLabel() { var layout = new DynamicLayout(); layout.BeginHorizontal(); TextBox text = new TextBox(); Button button = new Button { Text = "Set Badge Label" }; button.Click += (sender, e) => { Application.Instance.BadgeLabel = text.Text; }; layout.Add(new Label { Text = "Badge Label Text:", VerticalAlign = VerticalAlign.Middle }); layout.AddCentered(text); layout.Add(button); layout.EndHorizontal(); return layout; }
public DynamicFocusSection() { var content = new Panel(); var focusControlCheckBox = new CheckBox { Text = "Focus Control", Checked = true }; var addContentButton = new Button { Text = "Add Control" }; var count = 0; addContentButton.Click += (sender, e) => { Control control; switch((count++) % 9) { case 0: control = new TextBox(); break; case 1: control = new TextArea(); break; case 2: control = new CheckBox { Text = "A Check Box" }; break; case 3: control = new RadioButton { Text = "A Radio Button" }; break; case 4: control = new DropDown { Items = { "Item 1", "Item 2", "Item 3" } }; break; case 5: control = new DateTimePicker(); break; case 6: control = new ColorPicker(); break; case 7: control = new PasswordBox(); break; case 8: control = new ListBox { Items = { "Item 1", "Item 2", "Item 3" } }; break; case 9: control = new PasswordBox(); break; default: throw new InvalidOperationException(); } if (focusControlCheckBox.Checked ?? false) control.Focus(); content.Content = new TableLayout( null, new Label { Text = string.Format("Control: {0}", control.GetType().Name) }, new TableRow(control), null ); }; Content = new TableLayout( new TableLayout(new TableRow(null, addContentButton, focusControlCheckBox, null)), content ); }
Control PickFontFamily() { var fontFamilyName = new TextBox { Text = "Times, serif", Size = new Size (200, -1) }; var button = new Button { Text = "Set" }; button.Click += (sender, e) => { try { UpdatePreview(new Font(fontFamilyName.Text, selectedFont.Size)); } catch (Exception ex) { Log.Write(this, "Exception: {0}", ex); } }; var layout = new DynamicLayout(Padding.Empty); layout.BeginHorizontal(); layout.AddCentered(fontFamilyName, Padding.Empty, Size.Empty); layout.AddCentered(button, Padding.Empty, Size.Empty); return layout; }
void Init() { textBox_url = new TextBox(); textBox_url.TextChanged+=textBox_url_TextChanged; textBox_url.Text = "http://"; textBox_save = new TextBox(); textBox_save.Text = _saveDir; button_wget = new Button { Text = "Wget" }; button_wget.Click+=button_wget_Click; var layout = new DynamicLayout {Padding = new Padding(20, 10), Spacing = new Size(5, 5)}; var layout_left = new DynamicLayout(); layout_left.AddColumn(textBox_url, textBox_save); layout.AddRow(layout_left,button_wget); Content = layout; }
public PortManagerSettings(PortManagerProcess process) { _process = process; _name = new TextBox(); _name.Bind( tb => tb.Text, _process, proc => proc.Name, DualBindingMode.TwoWay); _processId = new NumericUpDown(); _processId.Bind( nud => nud.Value, _process, proc => proc.ProcessId, DualBindingMode.TwoWay); this.AddRow(new Label() { Text = Constants.ProcessNameLabel }, _name); this.AddRow(new Label() { Text = Constants.ProcessIdLabel }, _processId); this.AddRow(); }
public void AddingItemMultipleLevelsDeepShouldSetChildrenAndParent() { TestBase.Invoke(() => { var layout = new DynamicLayout(); var items = new List<Control>(); layout.BeginHorizontal(); Control ctl = new Button(); items.Add(ctl); layout.Add(ctl); layout.BeginVertical(); ctl = new Label(); items.Add(ctl); layout.Add(ctl); layout.EndVertical(); layout.EndHorizontal(); ctl = new TextBox(); items.Add(ctl); layout.Add(ctl); CollectionAssert.AreEqual(items, layout.Children, "#1. Items do not match"); foreach (var item in items) Assert.AreEqual(layout, item.Parent, "#2. Items should have parent set to dynamic layout"); layout.Clear(); foreach (var item in items) Assert.IsNull(item.Parent, "#3. Items should have parent removed when removed from dynamic layout"); }); }
Control ServerName () { var control = new TextBox (); control.Bind ("Text", "Name", DualBindingMode.OneWay); return control; }
/// <summary> /// Raises the text changed event. /// </summary> public void OnTextChanging(TextBox widget, TextChangingEventArgs e) { widget.Platform.Invoke(() => widget.OnTextChanging(e)); }
void Init() { // _textBoxFindText var labelFindText = new Label { Text = StrRes.GetString("StrFindContent", "FindContent") }; _textBoxFindText = new TextBox(); // _buttonFindNext _buttonFindNext = new Button { Text = StrRes.GetString("StrFindNext", "FindNext") }; _buttonFindNext.Click += _buttonFindNext_Click; // _buttonCancel _buttonCancel = new Button { Text = StrRes.GetString("StrCancel","Cancel") }; _buttonCancel.Click += _buttonCancel_Click; // _checkBoxCaseSensitive _checkBoxCaseSensitive = new CheckBox { Text = StrRes.GetString("StrCaseSensitive", "Case Sensitive") }; // _radio _radioButtonUp = new RadioButton { Text = StrRes.GetString("StrUp", "Up") }; _radioButtonDown = new RadioButton(_radioButtonUp) { Text = StrRes.GetString("StrDown", "Down") }; _radioButtonDown.Checked = true; var groupLayout = new DynamicLayout {Padding = new Padding(5, 5), Spacing = new Size(5, 5)}; groupLayout.AddRow(_radioButtonUp, _radioButtonDown); var group = new GroupBox { Text = StrRes.GetString("StrDirection", "Direction") }; group.Content = groupLayout; var layout = new DynamicLayout { Padding = new Padding(5, 5), Spacing = new Size(5, 5) }; layout.BeginHorizontal(); // left start ---> layout.BeginVertical(xscale: true); layout.BeginHorizontal(); layout.Add(labelFindText); layout.Add(_textBoxFindText); layout.EndHorizontal(); layout.Add(null); layout.BeginHorizontal(); layout.Add(_checkBoxCaseSensitive); layout.Add(group); layout.EndHorizontal(); layout.EndVertical(); // <--- left end // right start ---> layout.BeginVertical(xscale: false, yscale: false); layout.Add(_buttonFindNext); layout.Add(null); layout.Add(_buttonCancel); layout.EndVertical(); // <--- right end layout.EndHorizontal(); Content = layout; Title = StrRes.GetString("StrFind", "Find"); Minimizable = false; Maximizable = false; Topmost = true; ClientSize = new Size(350, 90); Resizable = false; }
Control TextBoxControl() { var control = new TextBox { Text = "TextBox Control" }; LogEvents(control); return control; }
void Init() { //_textBoxUrl _textBoxUrl = new TextBox(); //_buttonReadFile _buttonReadFile = new Button { Text = StrRes.GetString("StrLoad", "Load") }; _buttonReadFile.Click += _buttonReadFile_Click; //_buttonSaveFile _buttonSaveFile = new Button {Text = StrRes.GetString("StrSave","Save")}; _buttonSaveFile.Click += _buttonSaveFile_Click; //_textAreaBody _textAreaBody = new TextArea(); //rightMenu_Body var rightMenuBody = new ContextMenu(); var findCommand = new Command { MenuText = StrRes.GetString("StrFind", "Find"), Shortcut = Keys.F | Application.Instance.CommonModifier }; findCommand.Executed += findCommand_Executed; rightMenuBody.Items.Add(findCommand); var layout = new DynamicLayout { Padding = new Padding(5, 5), Spacing = new Size(5, 5) }; layout.BeginVertical(); layout.BeginHorizontal(); layout.AddCentered(_textBoxUrl, xscale: true, horizontalCenter: false); layout.AddCentered(_buttonReadFile, horizontalCenter: false); layout.AddCentered(_buttonSaveFile, horizontalCenter: false); layout.EndBeginHorizontal(); layout.EndVertical(); layout.AddRow(_textAreaBody); // bug in gtk2 layout.ContextMenu = rightMenuBody; layout.MouseUp += (sender, e) => { if (e.Buttons == MouseButtons.Alternate) { layout.ContextMenu.Show(_textAreaBody); } }; Content = layout; }