Hesham Desouky
Top achievements
Rank 2
Hesham Desouky
asked on 19 Mar 2012, 05:38 PM
Is it possible to prevent the CommandBar getting focus from current focused control
3 Answers, 1 is accepted
0
Hello Hesham,
Thank you for writing.
If you would like prevent RadCommandBar from taking the focus, you can use set its TabStop property to false. In this way when the user presses Tab the control will be skipped.
In case I have misunderstood your requirement, I kindly ask you to provide more details on your scenario. A detailed explanation, code snippets, or screenshots are possible ways of conveying important information regarding your scenario. Once I am able to fully understand your case, I will do my best to provide you with solution.
Kind regards,
Boryana
the Telerik team
Thank you for writing.
If you would like prevent RadCommandBar from taking the focus, you can use set its TabStop property to false. In this way when the user presses Tab the control will be skipped.
In case I have misunderstood your requirement, I kindly ask you to provide more details on your scenario. A detailed explanation, code snippets, or screenshots are possible ways of conveying important information regarding your scenario. Once I am able to fully understand your case, I will do my best to provide you with solution.
Kind regards,
Boryana
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Hesham Desouky
Top achievements
Rank 2
answered on 22 Mar 2012, 09:06 AM
Hello Boryana,
Thanks for your prompt reply.
The scenario is when having certain control in the the form with focus, the focus is lost when clicking one of the RadCommandBar button. This is not related to tabstop but to the mouse clicks.
This is not true for RadMenu, RadMenu didn't receive focus when selecting one of the menu items while RadCommandBar elements receive focus when clicking any of the bar elements.
This causes user to lose the ability to e.g. scrolling the focused control using mouse scroll wheel before clicking the RadCommandBar button after performing the click
Which requires the user to click the required control again to be able to scroll.
I tried a technique to return focus to desired control after clicking RadCommandBar item, but I think this solution is not good because the unfocusing/focusing cues give the user odd experience
What you think
Thanks for your prompt reply.
The scenario is when having certain control in the the form with focus, the focus is lost when clicking one of the RadCommandBar button. This is not related to tabstop but to the mouse clicks.
This is not true for RadMenu, RadMenu didn't receive focus when selecting one of the menu items while RadCommandBar elements receive focus when clicking any of the bar elements.
This causes user to lose the ability to e.g. scrolling the focused control using mouse scroll wheel before clicking the RadCommandBar button after performing the click
Which requires the user to click the required control again to be able to scroll.
I tried a technique to return focus to desired control after clicking RadCommandBar item, but I think this solution is not good because the unfocusing/focusing cues give the user odd experience
What you think
0
Hello,
Thank you for clarifying your scenario.
You can easily avoid the default behavior of RadCommandBar through overriding the ProcessFocusRequested method. Create a class that derives from RadCommandBar and set its ThemeClassName property, so that the theming mechanism can theme it as a RadCommandBar. Further, override the ProcessFocusRequested method and make it always return false:
The attached sample project demonstrates the above approach.
I hope this helps. Let me know if you have further questions.
Regards,
Boryana
the Telerik team
Thank you for clarifying your scenario.
You can easily avoid the default behavior of RadCommandBar through overriding the ProcessFocusRequested method. Create a class that derives from RadCommandBar and set its ThemeClassName property, so that the theming mechanism can theme it as a RadCommandBar. Further, override the ProcessFocusRequested method and make it always return false:
class
MyCommandBar: RadCommandBar
{
public
override
string
ThemeClassName
{
get
{
return
typeof
(RadCommandBar).FullName;
}
}
protected
override
bool
ProcessFocusRequested(RadElement element)
{
return
false
;
}
}
The attached sample project demonstrates the above approach.
I hope this helps. Let me know if you have further questions.
Regards,
Boryana
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>