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

radTextBox Cursor (WinForms)

3 Answers 323 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 02 Nov 2015, 12:18 PM

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?

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 02 Nov 2015, 03:50 PM
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

0
Martin
Top achievements
Rank 1
answered on 01 Apr 2016, 04:09 PM

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.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 05 Apr 2016, 08:14 AM
Hello Martin,

Thank you for writing back. 

The Cursors. 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.
Tags
TextBox
Asked by
Martin
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Martin
Top achievements
Rank 1
Share this question
or