public BreakpointPropertiesDialog(BreakEvent be, BreakpointType breakpointType) { this.be = be; Task.Run(LoadExceptionList); Initialize(); SetInitialData(); SetAccessibility(); SetLayout(); if (be == null) { switch (breakpointType) { case BreakpointType.Location: stopOnLocation.Active = true; entryLocationFile.SetFocus(); break; case BreakpointType.Function: stopOnFunction.Active = true; entryFunctionName.SetFocus(); break; case BreakpointType.Catchpoint: stopOnException.Active = true; entryExceptionType.SetFocus(); entryExceptionType.Text = "System.Exception"; entryExceptionType.SelectionStart = 0; entryExceptionType.SelectionLength = entryExceptionType.TextLength; break; } } }
public BreakpointPropertiesDialog(BreakEvent be, BreakpointType breakpointType) { this.be = be; LoadExceptionList(); Initialize(); SetInitialData(); SetLayout(); if (be == null) { switch (breakpointType) { case BreakpointType.Location: stopOnLocation.Active = true; entryLocationFile.SetFocus(); break; case BreakpointType.Function: stopOnFunction.Active = true; entryFunctionName.SetFocus(); break; case BreakpointType.Catchpoint: stopOnException.Active = true; entryExceptionType.SetFocus(); break; } } }
void PrivateKeyLocationButton_Clicked(object sender, EventArgs e) { var dialog = new SelectFileDialog(GettextCatalog.GetString("Select a private SSH key to use.")) { ShowHidden = true, CurrentFolder = System.IO.File.Exists(privateKeyLocationTextEntry.Text) ? System.IO.Path.GetDirectoryName(privateKeyLocationTextEntry.Text) : Environment.GetFolderPath(Environment.SpecialFolder.Personal) }; dialog.AddFilter(GettextCatalog.GetString("Private Key Files"), "*"); if (dialog.Run()) { privateKeyLocationTextEntry.Text = dialog.SelectedFile; if (System.IO.File.Exists(privateKeyLocationTextEntry.Text + ".pub")) { publicKeyLocationTextEntry.Text = privateKeyLocationTextEntry.Text + ".pub"; } OnCredentialsChanged(); if (string.IsNullOrEmpty(Credentials.PublicKey)) { publicKeyLocationTextEntry.SetFocus(); } else if (passphraseEntry.Sensitive) { passphraseEntry.SetFocus(); } } ; }
public Login() { var table = new Table(); var image = new ImageView { Image = Icons.UserInfo.WithBoxSize(96), }; userEntry = new TextEntry { Text = Environment.UserName, PlaceholderText = Application.TranslationCatalog.GetString("User"), }; passwordEntry = new PasswordEntry { PlaceholderText = Application.TranslationCatalog.GetString("Password"), }; var userLabel = new Label { Text = Application.TranslationCatalog.GetString("User"), TextAlignment = Alignment.Center, }; var passwordLabel = new Label { Text = Application.TranslationCatalog.GetString("Password"), TextAlignment = Alignment.Center, }; info = new Label { TextAlignment = Alignment.Center, TextColor = new Color(1, 0, 0), Visible = false, }; userEntry.Activated += delegate { passwordEntry.SetFocus(); }; passwordEntry.Activated += OnAutenticate; table.Add(image, 0, 0, 4); table.Add(userLabel, 1, 0); table.Add(userEntry, 1, 1); table.Add(passwordLabel, 1, 2); table.Add(passwordEntry, 1, 3); table.Add(info, 0, 4, colspan: 2); Content = table; if (string.IsNullOrWhiteSpace(userEntry.Text)) { userEntry.SetFocus(); } else { passwordEntry.SetFocus(); } Resizable = false; ShowInTaskbar = false; Title = Application.TranslationCatalog.GetString("Login"); Icon = Image.FromResource(GetType(), Resources.Icon); }
public NewFolderDialog(FilePath parentFolder) { this.parentFolder = parentFolder; Build(); folderNameTextEntry.Text = GetDefaultFolderName(); folderNameTextEntry.SetFocus(); folderNameTextEntry.Changed += FolderNameTextEntryChanged; addButton.Clicked += AddButtonClicked; }
public WidgetFocus() { var text = new TextEntry(); var check = new CheckBox("CheckBox"); var slider = new HSlider(); ListStore store = new ListStore(value); var list = new ListView(store); list.Columns.Add("Value", value); list.HeadersVisible = false; for (int n = 0; n < 10; n++) { var r = store.AddRow(); store.SetValue(r, value, "Value " + n); } var btn1 = new Button("TextEnty"); var btn2 = new Button("Checkbox"); var btn3 = new Button("Slider"); var btn4 = new Button("ListBox"); var btn5 = new Button("Button"); btn1.Clicked += (sender, e) => text.SetFocus(); btn2.Clicked += (sender, e) => check.SetFocus(); btn3.Clicked += (sender, e) => slider.SetFocus(); btn4.Clicked += (sender, e) => list.SetFocus(); btn5.Clicked += (sender, e) => btn1.SetFocus(); var btnBox = new HBox(); btnBox.PackStart(btn1); btnBox.PackStart(btn2); btnBox.PackStart(btn3); btnBox.PackStart(btn4); btnBox.PackStart(btn5); var focusBox = new HBox(); var vbox = new VBox(); vbox.PackStart(text); vbox.PackStart(check); vbox.PackStart(slider); focusBox.PackStart(vbox); focusBox.PackStart(list, true); PackStart(btnBox); PackStart(focusBox, true); }
protected override void AttachEditor() { editor.KeyPressed += KeyEditBehaviour; editor.DragOver += EditorDragOver; editor.DragDrop += EditorDragDrop; var loc = StyleEditor(editor); displayBackend.AddChild(editor, loc); editor.Text = DataToText(Current); editor.Visible = true; ActivateMarkers(); editor.SetFocus(); Display.ActiveVidget = editor; }
void ListingView_KeyReleased(object sender, Xwt.KeyEventArgs e) { if (e.Key == Xwt.Key.Return && ListingView.SelectedRow > -1) { NavigateTo(ListingView.PointedItem.Data[dfURL].ToString()); return; } if ((int)e.Key < 65000) //keys before 65000th are characters, numbers & other human stuff { QuickSearchText.Text += e.Key.ToString(); QuickSearchBox.Visible = true; QuickSearchText.SetFocus(); return; } if (Utilities.GetXwtBackendName() == "WPF") { ListingView.OnKeyPressed(e); } }
void BuildGui() { _typesBox.PackStart(_typesLabel); _typesBox.PackEnd(_generatorTypesComboBox); _optionsBox.PackStart(_optionsLabel); _optionsBox.PackEnd(_generatorOptionsComboBox); _numberBox.PackStart(_numberLabel, true); _numberBox.PackEnd(_numberEntry, false); _buttonBox.PackEnd(_generateButton); _mainBox.PackStart(_typesBox); _mainBox.PackStart(_optionsBox); _mainBox.PackStart(_numberBox); _mainBox.PackEnd(_buttonBox); _numberEntry.SetFocus(); Content = _mainBox; Resizable = false; }
protected override Widget GetMainControl() { var table = new Table(); var fields = scaffolder.Fields.ToArray(); var rowCount = fields.Count(); int rowAdditionCount = 0; for (int fieldIndex = 0; fieldIndex < rowCount; fieldIndex++) { int rowIndex = fieldIndex + rowAdditionCount; var field = fields [fieldIndex]; var label = new Label(); switch (field) { case StringField s: var input = new TextEntry(); label.Text = s.DisplayName; table.Add(label, 0, rowIndex, hpos: WidgetPlacement.End); table.Add(input, 1, rowIndex); input.Changed += (sender, args) => s.SelectedValue = input.Text; input.MinWidth = 300; input.Accessible.LabelWidget = label; input.SetFocus(); break; case ComboField comboField: ComboBox comboBox; if (comboField.IsEditable) { var comboBoxEntry = new ComboBoxEntry { Completes = true }; comboBoxEntry.TextEntry.Changed += (sender, args) => { if (!string.IsNullOrWhiteSpace(comboBoxEntry.TextEntry.Text)) { comboField.SelectedValue = comboBoxEntry.TextEntry.Text; } }; if (comboField.PlaceholderText != null) { comboBoxEntry.TextEntry.PlaceholderText = comboField.PlaceholderText; } comboBox = comboBoxEntry; } else { comboBox = new ComboBox(); } comboBox.MinWidth = 300; Task.Run(async() => { var options = await comboField.Options; await Runtime.RunInMainThread(() => { if (Args.CancellationToken.IsCancellationRequested) { return; } Xwt.Toolkit.NativeEngine.Invoke(() => { foreach (var option in options) { comboBox.Items.Add(option); } }); }); }, Args.CancellationToken); label.Text = comboField.DisplayName; table.Add(label, 0, rowIndex, hpos: WidgetPlacement.End); table.Add(comboBox, 1, rowIndex); comboBox.TextInput += (sender, args) => comboField.SelectedValue = comboBox.SelectedText; comboBox.SelectionChanged += (sender, args) => comboField.SelectedValue = comboBox.SelectedText; comboBox.Accessible.LabelWidget = label; break; case BoolFieldList boolFieldList: label.Text = boolFieldList.DisplayName; table.Add(label, 0, rowIndex, hpos: WidgetPlacement.End, vpos: WidgetPlacement.Start); var vbox = new VBox(); for (int i = 0; i < boolFieldList.Options.Count; i++) { var boolField = boolFieldList.Options [i]; var checkbox = new CheckBox(boolField.DisplayName) { Active = boolField.Selected, Sensitive = boolField.Enabled }; checkbox.Toggled += (sender, args) => boolField.Selected = checkbox.Active; vbox.PackStart(checkbox); } table.Add(vbox, 1, rowIndex); break; case FileField fileField: var fileSelector = new FileSelector(); if (!string.IsNullOrEmpty(fileField.FilterWildcard)) { // This doesn't work with native toolkit! var filter = new FileDialogFilter(fileField.FilterWildcard, fileField.FilterWildcard); fileSelector.Filters.Add(filter); } table.Add(fileSelector, 1, rowIndex); label.Text = fileField.DisplayName; table.Add(label, 1, rowIndex + 1); rowAdditionCount++; fileSelector.HeightRequest = 20; fileSelector.FileChanged += (sender, args) => fileField.SelectedValue = fileSelector.FileName; fileSelector.Accessible.LabelWidget = label; break; } } return(table); }
protected override void OnShown() { base.OnShown(); runConfigNameEntry.SetFocus(); }
/// <summary> /// Create list item with specific conditions. /// </summary> public EmailListItem(EmailList parent, Email s, Color bgColor) { // Set height MinHeight = EmailList.ROW_HEIGHT; HeightRequest = EmailList.ROW_HEIGHT; // Set background color BackgroundColor = DefaultColor = bgColor; // Self expand horizontal and vertical ExpandHorizontal = true; ExpandVertical = true; // No margin at all Margin = 0; // Set parent & active email ListParent = parent; ActiveEmail = s; EmailText = new TextEntry() { Text = s.UserEmail, MarginLeft = 5, HorizontalPlacement = WidgetPlacement.Fill, VerticalPlacement = WidgetPlacement.Center, MarginTop = 1, ExpandHorizontal = true, ExpandVertical = false }; EmailText.Changed += delegate { s.UserEmail = EmailText.Text; if (Email.IsValid(EmailText.Text)) { BackgroundColor = DefaultColor; } else { BackgroundColor = Colors.Red; EmailText.SetFocus(); } }; PackStart(EmailText, true, true); // Error Errors = new CheckBox() { State = (s.Errors) ? CheckBoxState.On : CheckBoxState.Off, WidthRequest = EmailList.ERROR_WIDTH, MinWidth = EmailList.ERROR_WIDTH, HorizontalPlacement = WidgetPlacement.Center, VerticalPlacement = WidgetPlacement.Center, MarginLeft = 25 }; Errors.Toggled += delegate { s.Errors = Errors.State == CheckBoxState.On; }; PackStart(Errors); // Notification Notification = new CheckBox() { State = (s.Notifications) ? CheckBoxState.On : CheckBoxState.Off, WidthRequest = EmailList.ERROR_WIDTH, MinWidth = EmailList.ERROR_WIDTH, HorizontalPlacement = WidgetPlacement.Center, VerticalPlacement = WidgetPlacement.Center }; Notification.Toggled += delegate { s.Notifications = Notification.State == CheckBoxState.On; }; PackStart(Notification); // Button RemoveEmail = new Button(Image.FromResource(DirectorImages.CROSS_ICON)) { HorizontalPlacement = WidgetPlacement.Center, VerticalPlacement = WidgetPlacement.Center, MarginRight = 20 }; RemoveEmail.Clicked += delegate { parent.RemoveEmail(ActiveEmail); }; PackStart(RemoveEmail); }
public override void SetFocus() { TextEntry.SetFocus(); }
public new void SetFocus() { entry.SetFocus(); }