SetFocus() change focus order by Tab
See original GitHub issueHello,
After applying SetFocus() to TextView the way of switching by Tab elements is changing. For example:
using Terminal.Gui;
namespace UICatalog {
[ScenarioMetadata (Name: "FocusOrder", Description: "Demonstrate change of focus order after SetFocus()")]
[ScenarioCategory ("Bug Repro")]
class FocusOrder : Scenario {
class TextFrame : FrameView {
private TextView textField;
public TextFrame (string title) : base (title) {
textField = new TextView () {
X = 0,
Y = 0,
Width = Dim.Fill () - 15,
Height = Dim.Fill(),
ColorScheme = Colors.Dialog,
Text = "0"
};
var button1 = new Button ("Button 1…") {
X = Pos.Right(textField)+1,
Y = Pos.Top(textField),
Clicked = () => { Button1Handler();}
};
var button2 = new Button ("Button 2…") {
X = Pos.X(button1),
Y = Pos.Y(button1)+2,
Clicked = () => { Button2Handler();}
};
Add(textField, button1, button2);
}
public bool showMessage() {
var d =MessageBox.ErrorQuery("Error", "Error", "Ok");
this.SetFocus(textField);
return true;
}
private void Button1Handler() {
}
private void Button2Handler() {
showMessage();
}
}
public override void Setup () {
var tf = new TextFrame ("Frame") {
X = 0,
Y = 0,
Width = Dim.Fill(),
Height = Dim.Fill() - 3
};
var button3 = new Button("Button 3") {
X = Pos.Percent(50) - 6,
Y = Pos.Bottom(tf) + 1,
};
Win.Add(tf, button3);
}
}
}
When focus changed by “Button 2” to TextView pressing Tab switch focus to “Button 3”. Estimated order is “Button 1”
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Control focus with tabindex - web.dev
Insert an element into the tab order # To focus an element, press the Tab key or call the element's focus() method.
Read more >Focus Next Element In Tab Index - javascript
The tab order of elements in a document is controlled by the tabindex attribute. If no value is set, the tabindex is effectively...
Read more >How do I change the order the elements on my page are ...
Tab focus order will follow the DOM order of elements by default. If your issue is solely related to elements being out of...
Read more >SetFocus function in Power Apps - Power Platform
The SetFocus function gives a control the input focus. The user's keystrokes are then received by that control, allowing them to type into...
Read more >How to set focus on tab
Solved: Hi, i created a custom table with few fields. i decided those fields to 2 tabs. i was able to hide /...
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
Both working; I cloned BDisp:setfocus-order
Thanks! The first variant works. The second generate exeption