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

You can right click to click button

15 Answers 1631 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 1
Erik asked on 18 Sep 2007, 06:44 AM
Hi Telerik

I face this case: we can you click a button by using right click of the mouse. How to disable it?
Thanks

15 Answers, 1 is accepted

Sort by
0
Kiril
Telerik team
answered on 18 Sep 2007, 02:52 PM
Hi Erik,

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
0
Phi
Top achievements
Rank 1
answered on 28 Sep 2007, 12:40 AM
I would tend to agree with Erik though, when you right-click on a button the default behaviour should not be that the button gets pressed.

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.
0
Kiril
Telerik team
answered on 28 Sep 2007, 08:22 AM
Hi Phi,

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
0
Ramius
Top achievements
Rank 1
answered on 09 Aug 2009, 01:17 PM

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

0
Nick
Telerik team
answered on 10 Aug 2009, 02:06 PM
Hi 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.
0
Ramius
Top achievements
Rank 1
answered on 10 Aug 2009, 02:44 PM

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

0
Nick
Telerik team
answered on 11 Aug 2009, 08:56 AM
Hello 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.
0
Ramius
Top achievements
Rank 1
answered on 19 Dec 2010, 01:24 PM
Hello Nick,

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
0
Richard Slade
Top achievements
Rank 2
answered on 19 Dec 2010, 02:05 PM
Hello 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
0
Ramius
Top achievements
Rank 1
answered on 19 Dec 2010, 02:37 PM

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

0
Stefan
Telerik team
answered on 22 Dec 2010, 05:04 PM
Hi guys,

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
Check out the Q1 2011 Roadmap for Telerik Controls for Windows Forms.
0
Ramius
Top achievements
Rank 1
answered on 27 Mar 2011, 06:19 PM

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

0
Stefan
Telerik team
answered on 30 Mar 2011, 03:45 PM
Hi 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
0
Mhmoud
Top achievements
Rank 1
answered on 19 Jan 2012, 08:05 AM
How Can Stop Right Click in radSpiltButton please in 2011 Q3
0
Nikolay
Telerik team
answered on 21 Jan 2012, 02:19 PM
Hello Mhmoud,

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).

Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Erik
Top achievements
Rank 1
Answers by
Kiril
Telerik team
Phi
Top achievements
Rank 1
Ramius
Top achievements
Rank 1
Nick
Telerik team
Richard Slade
Top achievements
Rank 2
Stefan
Telerik team
Mhmoud
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or