StartButtonImage Double-Click

13 posts, 1 answers
  1. Neil Welligan
    Neil Welligan avatar
    2 posts
    Member since:
    Jul 2007

    Posted 14 Feb 2008 Link to this post

    Hi,

    Is there an event that is exposed that can be used to capture the user double-clicking on the StartButtonImage on the RibbonBar?

    I would like for my application to close when the image is double-clicked.

    Thanks,

    neil
  2. Answer
    Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 15 Feb 2008 Link to this post

    Hi Neil Welligan,

    Thank you for writing.

    Indeed, you can close the form upon a double click event on the start button. You have to access the ActionButtonElement and then subscribe to its double click event:

    ActionButtonElement startButton = radRibbonBar1.RibbonBarElement.Children[2].Children[1].Children[1] as ActionButtonElement;  
    startButton.DoubleClick += new EventHandler(startButton_DoubleClick); 

    In the event handler the Close() method of the form should be invoked:

    private void startButton_DoubleClick(object sender, EventArgs e)  
    {  
        this.Close();  

    If you need additional assistance, do not hesitate to contact us.

    All the best,
    Nikolay
    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. Neil Welligan
    Neil Welligan avatar
    2 posts
    Member since:
    Jul 2007

    Posted 15 Feb 2008 Link to this post

    Thanks for your reply.

    Ideally I would appreciate the StartButton to be accessible as a property on the RibbonBar, but your solution works as requested.

    Thank you for your time.


    neil
  5. Daniel
    Daniel avatar
    91 posts
    Member since:
    Jan 2008

    Posted 01 Apr 2009 Link to this post

    Hello, this apparently doesn't work with Q1 2009 version of RabRibbonBar. Can you please provide us with updated solution. Thx

    Regards,
    Daniel
  6. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 02 Apr 2009 Link to this post

    Hi Daniel,

    Please consider using the following code snippet in Q1 2009:
    public Form1()  
    {  
        InitializeComponent();  
        this.radRibbonBar1.RibbonBarElement.ApplicationButtonElement.ActionButton.DoubleClick += new EventHandler(ActionButton_DoubleClick);  
    }  
     
    void ActionButton_DoubleClick(object sender, EventArgs e)  
    {  
        MessageBox.Show("I was double-clicked");  

    If you have additional questions, feel free to contact me.

    Greetings,
    Nikolay
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. Daniel
    Daniel avatar
    91 posts
    Member since:
    Jan 2008

    Posted 02 Apr 2009 Link to this post

    Thank you Nikolay, it works great and I see you improved button accessability.

    Cheers,
    Daniel
  8. Olivier Galloy
    Olivier Galloy avatar
    2 posts
    Member since:
    Feb 2010

    Posted 08 Feb 2010 Link to this post

    Hello,

     

    We are working with Q3 2009 SP1 RadRibbonBar and we try to use this code but it seems that doesn't work.
    Can you please  provide us with updated solution ?
    Thank you for your time.

    Olivier

  9. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 12 Feb 2010 Link to this post

    Hello Olivier Galloy,

    Due to numerous clients' requests we changed the click behavior of our RadControls/RadElements and now they behave just like the standard Microsoft controls - when you click twice on a button you get two Click events fired instead of one Click and one DoubleClick.

    However, you can easily get a DoubleClick behavior. Just measure the time span between the clicks and if it is smaller than the system DoubleClickTime, execute your custom action:
    public Form1()
    {
        InitializeComponent();
      
        this.radRibbonBar1.RibbonBarElement.ApplicationButtonElement.ActionButton.Click += new EventHandler(ActionButton_Click);
    }
      
    DateTime startClick = DateTime.MinValue;
      
    void ActionButton_Click(object sender, EventArgs e)
    {
        DateTime currentTime = DateTime.Now;
        TimeSpan span = currentTime - startClick;
        if (span.TotalMilliseconds < SystemInformation.DoubleClickTime)
        {
            this.Close();
        }
        startClick = currentTime;
    }

    If you have additional questions, feel free to contact me.

    Regards,
    Nikolay
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  10. Angel
    Angel avatar
    5 posts
    Member since:
    Jul 2012

    Posted 24 Jul 2012 Link to this post

    how can i do the same but whit MouseEnter event and change the Image icon of the StartButtonImage on the RibbonBar?

  11. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 27 Jul 2012 Link to this post

    Hello Angel,

    If I understand your question correctly, you should subscribe to the MouseEnter and MouseLeave events of the ActionButton and change the Image of the ApplicationButtonElement in the event handlers:

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
     
            this.radRibbonBar1.RibbonBarElement.ApplicationButtonElement.ActionButton.MouseEnter += new EventHandler(ActionButton_MouseEnter);
            this.radRibbonBar1.RibbonBarElement.ApplicationButtonElement.ActionButton.MouseLeave += new EventHandler(ActionButton_MouseLeave);
        }
     
        void ActionButton_MouseLeave(object sender, EventArgs e)
        {
            this.radRibbonBar1.RibbonBarElement.ApplicationButtonElement.Image = WindowsFormsApplication6.Properties.Resources.Image1;
        }
     
        void ActionButton_MouseEnter(object sender, EventArgs e)
        {
            this.radRibbonBar1.RibbonBarElement.ApplicationButtonElement.Image = WindowsFormsApplication6.Properties.Resources.Image2;
        }
    }

    I hope this helps.Kind regards,
    Nikolay
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  12. Marco
    Marco avatar
    19 posts
    Member since:
    Oct 2011

    Posted 23 Sep 2013 Link to this post

    Hello,

    this code isn't working for the 2013.2.612.40 version.

    Can you post a working sample?

    Regards,
    Marco

  13. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 24 Sep 2013 Link to this post

    Hello Marco,

    Could you please let me know which code snippet is of interest to you?

    The snippets that I provided on July 27, 2012 and Feb 12, 2010 work with the latest version and the code snippet from Feb 12, 2010 covers the functionality of the snippets given on Apr 2, 2009 and Feb 15, 2008.

    I am looking forward to your reply.

    Regards,
    Nikolay
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  14. Marco
    Marco avatar
    19 posts
    Member since:
    Oct 2011

    Posted 26 Sep 2013 Link to this post

    Hi Nikolay,

    thanks for you reply.

    I didn't know how to access the StartButton. I tried this code but it doesn't work

    ActionButtonElement startButton = radRibbonBar1.RibbonBarElement.Children[2].Children[1].Children[1] as ActionButtonElement; 
    startButton.DoubleClick += new EventHandler(startButton_DoubleClick);

    In the meantime I have tried the following code and it works for me...

    this.radRibbonBar.RibbonBarElement.ApplicationButtonElement.MouseDown += StartButton_MouseDown;

    Regards,
    Marco
Back to Top
UI for WinForms is Visual Studio 2017 Ready