M
Mike Frank
I am activating an InputPanel automatically, when entering a TextBox. I'm handling GotFocus and
LostFocus events and it works fine.
Now I want additionally to select all the text in the TextBox, when it got the focus, so the user
can start overwriting the existing text. So I added a textBox.SelectAll to the GotFocus handler
(code snippet below), but it does not work. If stepping through with the debugger I can see, that,
the text is selected, but after leaving the method, the selection by the click into the TextBox is
restored.
private void tbCriteria_GotFocus(object sender, EventArgs e)
{
this.inputPanel.Enabled = true;
tbCriteria.SelectAll();
}
I've tried also to make a special TextBox, that overrides it's OnGotFocus method and do the
SelectAll after base.OnGotFocus, but this does show the same effect.
I found no other events on the CF TextBox, that would handle the entering of a TextBox.
My workaround now, is to delete the text. This is right in the typical scenario for my app, but I
have cases, where I want the user to be able to edit the existing text.
Any Ideas?
Mike
LostFocus events and it works fine.
Now I want additionally to select all the text in the TextBox, when it got the focus, so the user
can start overwriting the existing text. So I added a textBox.SelectAll to the GotFocus handler
(code snippet below), but it does not work. If stepping through with the debugger I can see, that,
the text is selected, but after leaving the method, the selection by the click into the TextBox is
restored.
private void tbCriteria_GotFocus(object sender, EventArgs e)
{
this.inputPanel.Enabled = true;
tbCriteria.SelectAll();
}
I've tried also to make a special TextBox, that overrides it's OnGotFocus method and do the
SelectAll after base.OnGotFocus, but this does show the same effect.
I found no other events on the CF TextBox, that would handle the entering of a TextBox.
My workaround now, is to delete the text. This is right in the typical scenario for my app, but I
have cases, where I want the user to be able to edit the existing text.
Any Ideas?
Mike