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

RadButton - How to disable input focus???

5 Answers 546 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Matjaz
Top achievements
Rank 1
Matjaz asked on 23 Feb 2009, 02:05 PM
Hi,

I'm facing simple but painful problem with RadButton control for WinForms. I want to prevent button to receive input focus! In my case I have one textbox and button which is used to clear contents of textbox. After click on button textbox must stay focused. Setting "CanFocus" property to false doesn't help! Button allways get input focus. Why? Is there any shortcut? I'm doing something wrong?

Regards,
Matjaz

5 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 23 Feb 2009, 03:39 PM
Hi Matjaz,

Thank you for using our support system. Just call the Focus() method of your text box at the end of the your button click event handler. I hope this is what you are looking for. Please write back if you need further assistance.

Regards,
Victor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Matjaz
Top achievements
Rank 1
answered on 23 Feb 2009, 05:04 PM
Hi,

Sorry, but you've missed the problem. I just want to disable input focus on the Button control with set "CanFocus" property value to false. Click on button set focus to the button and I don't want that. That's all. How to disable focus on the button???

Regards,
Matjaz
0
Matjaz
Top achievements
Rank 1
answered on 26 Feb 2009, 06:49 AM
Hi,

is anybody there???
0
Victor
Telerik team
answered on 26 Feb 2009, 03:01 PM
Hi Matjaz,

Thank you for writing. Please excuse me for the delay in the response.

The CanFocus property is readonly, you can not assign a value to it. There is no way to make the RadButton or even the standard WinForms Button un-focusable. You can set their TabStop properties to false and that is pretty much all you can do. As I wrote previously you can just set the focus to the text box manually.

Actually there is a way but it is not worth the effort for something as simple as this. You can inherit RadButton and override the WndProc method. In it you can ignore all messages that deal with the button focus. Please search the MSDN for articles or threads on how to do that.

Please write again if you have other questions. There is a 72 hour response time for forum posts although we may respond faster.

Regards,
Victor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Matjaz
Top achievements
Rank 1
answered on 26 Feb 2009, 08:37 PM
Thank you for your answer!

Regards,
Matjaz
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Matjaz
Top achievements
Rank 1
Answers by
Victor
Telerik team
Matjaz
Top achievements
Rank 1
Share this question
or