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

RadRichTextBox gets focus but does not display cursor and typing has no effect.

6 Answers 392 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 29 Sep 2010, 08:35 PM
I'm using a radrichtextbox with the radrichtextboxribbonui in a grid.  Above it I have a RadMenu with a "format" submenu.  When it loses focus, I call

private void ReturnLastFocus(object sender, Telerik.Windows.RadRoutedEventArgs e)
        {
                _myRTB.Focus();
                _myRTB.UpdateEditorLayout();
        }
 
I've tried creating a new method called when myRTB.GotFocus and placing '_myRTB.UpdateEditorLayout();' in there and it made no difference.  
My bold function works for whatever is selected, the focus is set to _myRTB, but for whatever reason the cursor doesn't display, and input from the keyboard is ignored.
Any ideas?

6 Answers, 1 is accepted

Sort by
0
Accepted
Iva Toteva
Telerik team
answered on 30 Sep 2010, 05:41 PM
Hello Michael,

There was an issue related to RadRichTextBox.Focus() method that we resolved in Q2.SP2 release.
Here is a workaround for the previous versions (Q2.SP1 and earlier):
((DocumentPresenterBase)this.radRichTextBox1.ActiveEditorPresenter).FocusCaret();

With SP2 version the cursor should appear on the position it was last as soon as your RadRichTextBox receives the focus . You set the focus as simple as this:
this._myRTB.Focus();

If the cursor does not appear where it last was, then you are probably using an older version of our controls and you have to manually set the position of the cursor, as shown below:
Telerik.Windows.Documents.Model.PointF location = this._myRTB.Document.CaretPosition.Location;
this._myRTB.Document.CaretPosition.SetPosition(location);

Let us know whether this helps.
 
Regards,
Iva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Michael
Top achievements
Rank 1
answered on 30 Sep 2010, 06:16 PM
This worked perfectly, but I think an update would be my better option.
Thanks for your help.
0
Marc
Top achievements
Rank 1
answered on 17 Jun 2017, 12:09 AM

I just ran into this problem again today.  I was calling:

radRichTextBox.Focus();

and the focus was not going into the radRichTextBox and the caret was not being displayed.

I replaced it with a call to:

((DocumentPresenterBase)radRichTextBox.ActiveEditorPresenter).FocusCaret();

And everything is working fine.

I am using v2017.2.503 of the Telerik libraries (I think that is Q2 2017).

0
Marc
Top achievements
Rank 1
answered on 17 Jun 2017, 12:12 AM

Sorry to necro this thread.

I had thought the change I made above fixed the problem I was seeing.  It did not.  I need to look further into the problem I am seeing.

0
Andrew
Top achievements
Rank 1
answered on 02 Apr 2018, 07:44 PM
We're seeing the same issue - the caret sporadically disappearing - which is more likely to happen on monitors with non-standard DPI. We believe it's a Telerik bug. I'll see if can create a self-contained repro app.
0
Tanya
Telerik team
answered on 05 Apr 2018, 01:36 PM
Hi Andrew,

We have logged an issue that the caret inside the document disappears but the focus remains in the control and users are able to use it as expected. The issue in question is reproduced only in WPF and only when the scale factor of RadRichTextBox is less than 100%. You can find the information we have about this behavior in the related public item. Could you please confirm whether the case you are observing is the same or it is different? If it is different, a more detailed description of the steps that can be used to reproduce the behavior would be much appreciated. 

Regards,
Tanya
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
RichTextBox
Asked by
Michael
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Michael
Top achievements
Rank 1
Marc
Top achievements
Rank 1
Andrew
Top achievements
Rank 1
Tanya
Telerik team
Share this question
or