You can right click to click button

16 posts, 0 answers
  1. Erik
    Erik avatar
    80 posts
    Member since:
    Jul 2007

    Posted 18 Sep 2007 Link to this post

    Hi Telerik

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

    Posted 18 Sep 2007 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Phi
    Phi avatar
    19 posts
    Member since:
    Jun 2007

    Posted 27 Sep 2007 Link to this post

    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.
  5. Kiril
    Admin
    Kiril avatar
    158 posts

    Posted 28 Sep 2007 Link to this post

    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
  6. Ramius
    Ramius avatar
    127 posts
    Member since:
    Feb 2008

    Posted 09 Aug 2009 Link to this post

    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

  7. Nick
    Admin
    Nick avatar
    767 posts

    Posted 10 Aug 2009 Link to this post

    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.
  8. Ramius
    Ramius avatar
    127 posts
    Member since:
    Feb 2008

    Posted 10 Aug 2009 Link to this post

    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

  9. Nick
    Admin
    Nick avatar
    767 posts

    Posted 11 Aug 2009 Link to this post

    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.
  10. Ramius
    Ramius avatar
    127 posts
    Member since:
    Feb 2008

    Posted 19 Dec 2010 Link to this post

    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
  11. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 19 Dec 2010 Link to this post

    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
  12. Ramius
    Ramius avatar
    127 posts
    Member since:
    Feb 2008

    Posted 19 Dec 2010 Link to this post

    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

  13. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 22 Dec 2010 Link to this post

    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.
  14. Ramius
    Ramius avatar
    127 posts
    Member since:
    Feb 2008

    Posted 27 Mar 2011 Link to this post

    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

  15. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 30 Mar 2011 Link to this post

    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
  16. Mhmoud
    Mhmoud avatar
    1 posts
    Member since:
    Jan 2012

    Posted 19 Jan 2012 Link to this post

    How Can Stop Right Click in radSpiltButton please in 2011 Q3
  17. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 21 Jan 2012 Link to this post

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

Back to Top
UI for WinForms is Visual Studio 2017 Ready