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

StartButtonImage Double-Click

12 Answers 141 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Neil Welligan
Top achievements
Rank 1
Neil Welligan asked on 14 Feb 2008, 05:30 PM
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

12 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay
Telerik team
answered on 15 Feb 2008, 01:40 PM
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
0
Neil Welligan
Top achievements
Rank 1
answered on 15 Feb 2008, 02:11 PM
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
0
Daniel
Top achievements
Rank 1
answered on 01 Apr 2009, 03:57 PM
Hello, this apparently doesn't work with Q1 2009 version of RabRibbonBar. Can you please provide us with updated solution. Thx

Regards,
Daniel
0
Nikolay
Telerik team
answered on 02 Apr 2009, 03:49 PM
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
0
Daniel
Top achievements
Rank 1
answered on 02 Apr 2009, 04:26 PM
Thank you Nikolay, it works great and I see you improved button accessability.

Cheers,
Daniel
0
Olivier Galloy
Top achievements
Rank 1
answered on 08 Feb 2010, 04:48 PM

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

0
Nikolay
Telerik team
answered on 12 Feb 2010, 12:42 PM
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.
0
Angel
Top achievements
Rank 1
answered on 24 Jul 2012, 01:21 PM
how can i do the same but whit MouseEnter event and change the Image icon of the StartButtonImage on the RibbonBar?

0
Nikolay
Telerik team
answered on 27 Jul 2012, 03:41 PM
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 >>
0
Marco
Top achievements
Rank 1
answered on 23 Sep 2013, 11:32 AM
Hello,

this code isn't working for the 2013.2.612.40 version.

Can you post a working sample?

Regards,
Marco

0
Nikolay
Telerik team
answered on 24 Sep 2013, 03:32 PM
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 >>
0
Marco
Top achievements
Rank 1
answered on 26 Sep 2013, 06:30 AM
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
Tags
RibbonBar
Asked by
Neil Welligan
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Neil Welligan
Top achievements
Rank 1
Daniel
Top achievements
Rank 1
Olivier Galloy
Top achievements
Rank 1
Angel
Top achievements
Rank 1
Marco
Top achievements
Rank 1
Share this question
or