radTextBox Cursor (WinForms)

4 posts, 0 answers
  1. Martin
    Martin avatar
    35 posts
    Member since:
    Jun 2014

    Posted 02 Nov 2015 Link to this post

    Hi,

    No matter what I set a radTextBox cursor to, whenever the mouse enters the controls it is always an IBeam.

    Is this a bug in the control?

    I've set it at design time (Cursor = Arrow) in the control properties and I've also tried setting it at runtime on Mouse_Enter etc, but it is always an IBeam. When the textbox is read only I want it to be an Arrow.

    Any suggestions folks?

  2. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 02 Nov 2015 Link to this post

    Hello Martin,

    Thank you for writing.

    RadTextBox hosts the MS TextBox. In order to achieve your goal, you can subscribe to the RadTextBox.TextBoxElement.TextBoxItem.TextBoxControl.Cursor property to Cursors.Arrow:
    this.radTextBox1.TextBoxElement.TextBoxItem.TextBoxControl.Cursor = Cursors.Arrow;

    I hope this information helps. Should you have further questions I would be glad to help.
     
    Regards,
    Dess
    Telerik

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Martin
    Martin avatar
    35 posts
    Member since:
    Jun 2014

    Posted 01 Apr in reply to Dess Link to this post

    Hi Dess,

    I've got the following little method:

    public static void SetTextBoxReadOnly(RadPanel pnl, bool readonlystatus)
            {
                foreach (var txtbox in pnl.Controls.OfType<RadTextBox>())
                {
                    txtbox.ReadOnly = readonlystatus;
                    if (readonlystatus == true)
                        txtbox.TextBoxElement.TextBoxItem.TextBoxControl.Cursor = Cursors.Arrow;
                    else
                        txtbox.TextBoxElement.TextBoxItem.TextBoxControl.Cursor = Cursors.Default;
                }
            }

    When the form is loaded the cursor on the textbox is set to 'Arrow' and it works fine. However, it will not go back to 'Default' when the status of ReadOnly is switched.

  5. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 05 Apr Link to this post

    Hello Martin,

    Thank you for writing back. 

    The Cursors.Default is usually an arrow cursor. That is why when you make the RadTextBox read only, you explicitly set Cursor to Cursors.Arrow. Otherwise, you set Cursors.Default which actually does not affect the cursor. Feel free to change back to the Cursors.IBeam.

    I hope this information helps. If you have any additional questions, please let me know.

    Regards,
    Dess
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top