Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Ribbonbar > StartButtonImage Double-Click

Answered StartButtonImage Double-Click

Feed from this thread
  • Neil Welligan avatar

    Posted on Feb 14, 2008 (permalink)

    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

    Reply

  • Answer Nikolay Nikolay admin's avatar

    Posted on Feb 15, 2008 (permalink)

    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

    Reply

  • Neil Welligan avatar

    Posted on Feb 15, 2008 (permalink)

    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

    Reply

  • Daniel Intermediate avatar

    Posted on Apr 1, 2009 (permalink)

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

    Regards,
    Daniel

    Reply

  • Nikolay Nikolay admin's avatar

    Posted on Apr 2, 2009 (permalink)

    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

    Reply

  • Daniel Intermediate avatar

    Posted on Apr 2, 2009 (permalink)

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

    Cheers,
    Daniel

    Reply

  • Olivier Galloy avatar

    Posted on Feb 8, 2010 (permalink)

    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

    Reply

  • Nikolay Nikolay admin's avatar

    Posted on Feb 12, 2010 (permalink)

    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.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Ribbonbar > StartButtonImage Double-Click
Related resources for "StartButtonImage Double-Click"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]