Hi there,
i have got the problem that the UltraTextEditor does not receive the Input Focus when calling the Focus() Method.
First of all, i set the UltraTextEditor as Active Control and after that i call the Focus() Method.
Then the UltraTextEditor is Active but does not have the Input Focus.
When i switch to an other open window and return back to my window with the UltraTextEditor, it receives automatic the Input Focus.
Does anyone have an idea?
Thank you.
In what event are you calling the Focus method? Focus() will not work for any control inside events that occur before the form is shown. So that includes Form_Load.
i tried to call it in Load and Shown Event of the Form.
Every Time i checked the CanFocus Property, it was False.
Thank you, i will try it on monday.
HI Mike,
now i tested it with BeginInvoke and it doesnt work too.
When i try to Focus a common TextBox, it works.
What are the requirements that CanFocus on UltraTextEditor will be True?
I just tested this out and it works fine for me:
private void Form1_Load(object sender, EventArgs e) { this.BeginInvoke(new MethodInvoker(this.SetFocusToUltraTextEditor)); } private void SetFocusToUltraTextEditor() { this.ultraTextEditor1.Focus(); }
Thank you!
the MethodInvoker makes the difference...
i used a common delegate to invoke my method.
thanks a lot and have a nice day.
The MethodInvoker was not the Problem..
The ActiveControl was the Problem.
As following it doesnt work:
this.ActiveControl = myControl;
this.ActiveControl.Focus();
It works.
I don't see how they type of delegate could make any difference. Are you saying it's still not working?