User (Old forums)MemberSeptember 13, 2006 at 10:37 amPost count: 23064
we converted our project to .NET2.0 and found out that TextBoxes behave differently than in 1.1… when tabbing to them, the contents are no longer selected.
The XCeed WinTextBox.TextArea.SelectOnFocus seems to be the solution to this problem, but it is by default false.
We have a large number of textboxes in our application – all of them would have to be converted by hand and every new TextBox would need this flag – if someone forgets this, the box would behave differently than the others – our customers already complained about it.
So my question: is there any possibility to globally set SelectOnFocus for our application? Or is there any other solution for our problem?
Thanks in advance,
Imported from legacy forums. Posted by mike_t (had 4334 views)User (Old forums)MemberSeptember 14, 2006 at 2:33 pmPost count: 23064
The WinTextBox has the same behavior in both .NET1.1 and .NET 2.0 with our latest version (3.2.6403.0). The WinTextBox.TextBoxArea.SelectOnFocus is false by default. We just tested it.
So it is possible that you have a version that, for some reason, had a bug which made the behavior differ from one version of .NET to the other.
Unfortunately, in your case, you will have to set the SelectOnFocus to true everywhere.
The only other solution is to create a custom class deriving from WinTextBox, override the CreateTextBoxArea, set the SelectOnFocus to true in there, and then do a CTRL-SHIFT-H in your project, and replace all the Xceed.Editors.WinTextBox (and/or WinTextBox) with the name of this new class.
public class AutoSelectWinTextBox : WinTextBox
protected override TextBoxArea CreateTextBoxArea()
TextBoxArea textBoxArea = base.CreateTextBoxArea();
textBoxArea.SelectOnFocus = true;
Imported from legacy forums. Posted by André (had 275 views)User (Old forums)MemberSeptember 15, 2006 at 3:02 amPost count: 23064
Thanks for your reply, we will implement the derived solution – so we are prepared for the future if something changes in .NET 3 😉
Imported from legacy forums. Posted by mike_t (had 379 views)User (Old forums)MemberApril 4, 2007 at 12:38 amPost count: 23064
A rew more WinTextBox questions:
1. If you have TextBoxArea.SelectOnFocus set to false, why won’t a WinTextBox keep the SelectionStart and SelectionLength state when you tab away then back to it? The standard Windows TextBox does.
2. Why does the WinTextBox always position the caret to the end of the text when it gets focus via the keyboard?
3. If you have TextBoxArea.SelectOnFocus set to true, all the text gets selected not only when you focus the control via a keystroke, but also when you give it focus via a mouse click. Standard windows behavior is to select all text only when focusing the control via the keyboard (I mean on data-entry type forms, not the few exceptions like the address bar in IE).
Any work-arounds for these?
Imported from legacy forums. Posted by Glenn (had 461 views)User (Old forums)MemberApril 16, 2007 at 2:24 pmPost count: 23064
Due to masking and how text is manipulated in the TextBoxArea, some standard .NET TextBox behavior are impacted, as those you mention here. There is nothing we can do to change this.
Imported from legacy forums. Posted by André (had 4856 views)
- You must be logged in to reply to this topic.