This is a migrated thread and some comments may be shown as answers.

RadRichTextBox.Focus() on startup

1 Answer 76 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Jasper
Top achievements
Rank 1
Jasper asked on 15 Apr 2014, 11:48 AM
Hi,


I need to get the RadRichTextBox to focus (without using any mouse click) when the editor has been fully loaded.
I'm trying this with the following code:

public MainPage() {
InitializeComponent();
this.radRichTextBox.Focus();
this.radRichTextBox.UpdateEditorLayout(true);
}

This is not working. Can't figure out why..
As soon as i click anywhere in the editor, it will focus, but I want it to focus automaticly without clicking manually.

Is this possible?

Kind regards
PS: I'm using the latest trial version.

1 Answer, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 17 Apr 2014, 12:36 PM
Hi Jasper,

Could you please share what is the behavior when testing with different browsers?

It seems this might be related to a common issue of Google Chrome/Safari and Flash/Silverlight plug-ins. In a gist, the problem is that the browser does not pass the focus to the plugin when loading, so there is no way to pass it to the RadRichTextBox either. We haven't been able to come up with a good solution for this issue so far but you can try searching around on the web. What we have used in the past was the following hack:
this.Loaded += (s, a) =>
{
    HtmlPage.Plugin.Focus();
    this.radRichTextBox.Focus();
};
put in the user control containing the RadRichTextBox, but this seems to not work consistently (and especially for Chrome).

I hope the provided information is helpful.

Regards,
Petya
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
RichTextBox
Asked by
Jasper
Top achievements
Rank 1
Answers by
Petya
Telerik team
Share this question
or