15 Answers, 1 is accepted
Thanks for writing. It is indeed a bit unclear how to handle this situation.
You could handle the MouseClick event, which gives you information on which mouse button was used to click the RadButton. You could then only handle the case where the left button was clicked. You might still want to handle the Click event, in case the RadButton was clicked using the keyboard.
Take a look at the sample event handler of the MouseClick event in the codeblock below. It separates clicks coming from the different buttons of the mouse.
private void radButton1_MouseClick(object sender, MouseEventArgs e) |
{ |
//button was clicked by the mouse |
if (e.Button == MouseButtons.Left) |
MessageBox.Show("Left button click"); |
else if (e.Button == MouseButtons.Middle) |
MessageBox.Show("Middle button click"); |
else if (e.Button == MouseButtons.Right) |
MessageBox.Show("Right button click"); |
} |
I hope this helps.
Thanks again for writing us, and letting us provide more information on this issue.
All the best,
Kiril
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
If you look at most (if not all) other button controls for winforms and web, right-clicking a button only brings up context menus. It is only the left-click that executes the button press.
Interested to hear your thoughts.
You are absolutely right. Only the logical left button of the mouse (which can be changed using the control panel - mouse settings) should trigger the button click event, while you'll be able to handle the right mouse button click separately.
We will provide this functionality in future releases.
Thanks again to you and Erik for starting this discussion, and helping us to clarify how this functionality should be implemented.
Best wishes,
Kiril
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Hello,
i am using the q2'09 SP1-Release and this behaviour still hasn't changed.
How can i get the standard windows behaviour for the mouse click event ?
This behaviour seams to be common with many telerik controls.
Do i have to change the mouse click event for all of them ?
Regards,
Ramius
Thank you for contacting us. It is still not fixed and we will try to sort this out soon.
In the meantime, you can use the MouseDown event instead:
private void radButton1_MouseDown(object sender, MouseEventArgs e) |
{ |
if (e.Button == MouseButtons.Left) |
{ |
MessageBox.Show("Clicked"); |
} |
} |
I hope that helps.
As to your second question, well I am not sure, which other controls do you use that have the same behavior like RadButton?
Regards,
Nick
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.
Hello Nick,
thank you for your help.
As to your second question, well I am not sure, which other controls do you use that have the same behavior like RadButton?
For example the following controls:
RadCheckBox, RadDropDownButton, RadRadioButton, RadSplitButton,
RadTreeView (the +/- Button),
RadCalendar,
RadScheduler,
RadTabStrip ( changing Tabs )
This looks for me like every button in all controls has this behaviour.
Regards,
Ramius
You are correct, we need to apply several changes in the event system in general. Thank you for your detailed feedback. I have updated your Telerik points.
Regards,
Nick
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.
now i am using Q3 2010 SP1 Release, but this behaviour still has not changed.
You wrote that Telerik will try to sort this out soon.
When will this bug get fixed ?
Kind Regards,
Ramius
You can track the status of this bug at this PITS link. As you can see, the bug is currently in progress.
Hope that helps
Richard
Hello Richard,
i know that it is in pitts and i have voted there for it long time ago. But the bug is now for several releases in the status "in progress".
Regards,
Ramius
Thank you all for writing.
Indeed, we did not manage to deal with this issue in favor to other issues that were with higher priority and that we have handled. Since I noticed there is quite a bit of interest, we will consider increasing the priority of this issue.
Let me know if you need anything else.
Best wishes,
Stefan
the Telerik team
Hello,
i am very happy, that this bug is finally fixed with the Q1/2011 Release.
But in the RadPageView it is still possible to close a page with a right mouse click on the "x"-symbol.
Regards,
Ramius
Thank you for writing.
Yes, in RadPageView you can still close pages by right clicking the close button (strip mode). We will consider if we should change this behavior.
If you notice any other controls where this behavior is observed, do not hesitate to write back.
Regards,
Stefan
the Telerik team
You can achieve your requirement by using an extended RadSplitButton:
public
class
MySplitButton : RadSplitButton
{
protected
override
void
OnMouseDown(System.Windows.Forms.MouseEventArgs e)
{
if
(e.Button != System.Windows.Forms.MouseButtons.Left)
{
return
;
}
base
.OnMouseDown(e);
}
public
override
string
ThemeClassName
{
get
{
return
typeof
(RadSplitButton).FullName;
}
}
}
I hope this helps.
All the best,Nikolay
the Telerik team
SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).