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

7 posts, 1 answers
  1. Michael
    Michael avatar
    15 posts
    Member since:
    Sep 2010

    Posted 29 Sep 2010 Link to this post

    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?
  2. Answer
    Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 30 Sep 2010 Link to this post

    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
  3. Michael
    Michael avatar
    15 posts
    Member since:
    Sep 2010

    Posted 30 Sep 2010 Link to this post

    This worked perfectly, but I think an update would be my better option.
    Thanks for your help.
  4. Marc
    Marc avatar
    4 posts
    Member since:
    Jun 2016

    Posted 16 Jun 2017 in reply to Iva Toteva Link to this post

    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).

  5. Marc
    Marc avatar
    4 posts
    Member since:
    Jun 2016

    Posted 16 Jun 2017 in reply to Marc Link to this post

    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.

  6. Andrew
    Andrew avatar
    3 posts
    Member since:
    Feb 2015

    Posted 02 Apr 2018 Link to this post

    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.
  7. Tanya
    Admin
    Tanya avatar
    848 posts

    Posted 05 Apr 2018 Link to this post

    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.
Back to Top