ComboBox focused last
See original GitHub issueHey, maybe I do something wrong but I have a problem that ComboBox is always focused last.
using System.Collections.Generic;
using NStack;
using Terminal.Gui;
namespace UICatalog.Scenarios {
[ScenarioMetadata (Name: "ComboBox focus bug",
Description: "Demonstrates ComboBox bug")]
[ScenarioCategory ("Bug Repro")]
public class ComboBoxBug : Scenario {
public override void Setup ()
{
var typeRadioGroup = new RadioGroup (0, 0, new ustring [] {"Expense", "Income"}, 0);
Win.Add (typeRadioGroup);
var nameLabel = new Label ("Name") {
X = Pos.Left (typeRadioGroup),
Y = Pos.Top (typeRadioGroup) + 2
};
var nameTextField = new TextField ("") {
X = Pos.Left (nameLabel),
Y = Pos.Top (nameLabel) + 1,
Width = Dim.Fill ()
};
Win.Add (nameLabel);
Win.Add (nameTextField);
var categoryLabel = new Label ("Category ComboBox") {
X = Pos.Left (nameTextField),
Y = Pos.Top (nameTextField) + 2
};
var categoryComboBox = new ComboBox () {
ColorScheme = Colors.TopLevel,
X = Pos.Left (categoryLabel),
Y = Pos.Top (categoryLabel) + 1,
Width = Dim.Fill (),
Height = Dim.Fill (2),
};
categoryComboBox.SetSource (new List<string> () {
"Cat 1",
"Other category"
});
Win.Add (categoryLabel);
Win.Add (categoryComboBox);
var amountLabel = new Label ("Amount") {
X = Pos.Left (categoryComboBox),
Y = Pos.Top (categoryComboBox) + 2
};
var amountTextField = new TextField ("") {
X = Pos.Left (amountLabel),
Y = Pos.Top (amountLabel) + 1,
Width = Dim.Fill ()
};
Win.Add (amountLabel);
Win.Add (amountTextField);
var saveButton = new Button ("Save") {
X = Pos.Left (amountTextField),
Y = Pos.Top (amountTextField) + 2
};
var cancelButton = new Button ("Cancel") {
X = Pos.Right (saveButton),
Y = Pos.Top (saveButton),
Clicked = Application.RequestStop
};
Win.Add (saveButton);
Win.Add (cancelButton);
}
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
c# - Set focus back on a ComboBox if the value is incorrect
I am trying to set my ComboBoxes so that the user can either choose from the list or set their own value (the...
Read more >ComboBox.Focused Property (System.Windows.Forms)
Gets a value indicating whether the ComboBox has focus.
Read more >Combobox Pattern | APG | WAI
End (Optional): Either moves focus to the last option or, if the combobox is editable, returns focus to the combobox and places the...
Read more >Thread: [RESOLVED] Setting focus to ComboBox
I'm trying to set the focus to a ComboBox on program startup. I have this code in my form load event: Me.ComboBox1.Focus() The...
Read more >How to Set Focus to textbox after combobox selection
Hi, Just use the .SetFocus method once the control is visible. You can't set focus to an invisible control. A couple of things...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Shift + Tab fixed in PR #710
Thank you for my part. It was what I suspected. This method removes a view and adds it on top of the other views and its index is changed. We will have to force it to maintain the same index. Thanks for the info.