Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
Hide Shortcuts for ButtonTools in the Ribbon ApplicationMenu
posted

Hello all,

I have several ButtonTool objects displayed in my Ribbon ApplicationMenu. They're set for display as ImageAndText, if that matters. Once I assigned a Shortcut to them, they display in the ApplicationMenu with their shortcuts out to the right-hand side. I want the shortcuts to only show up in the ToolTip, not in the Caption. Is there a way I can accomplish this?

I'm using NetAdvantage  2007 Vol. 3 for CLR 2.0.

I've searched but could not find an answer to this question. Hope someone can help!

Regards,

Chris

Parents
No Data
Reply
  • 44743
    Verified Answer
    posted

    Unfortunately, this isn't directly supported, but can be accomplished. I would recommend submitting a feature request for this to the support group: http://devcenter.infragistics.com/Protected/RequestFeature.aspx.

    To accomplish this manually, you can do the following (assuming you're doing it to ButtonTool1 which has a shortcut of Ctrl+S):

    1. Set the SharedProps.Shortcut of ButtonTool1 to None.

    2. Set the SharedProps.ToolTipText of ButtonTool1 to <the caption or whatever other text you want to describe the button> + " (" + TypeDescriptor.GetConverter( typeof( Keys ) ).ConvertToString( (Keys)Shortcut.CtrlS ) + ")".

    3. If the code handling ButtonTool1's click is in the main ToolClick event handler:

        a. Move the code handling the ButtonTool1 click from the ToolClick event handler into its own method.

        b. Add a call to the new ButtonTool1 click handler method when the code was in the ToolClick event handler.

    4. Override ProcessDialogKey in your form with the following code:

    protected override bool ProcessDialogKey( Keys keyData )
    {
     if ( keyData == (Keys)Shortcut.CtrlS )
     {
      // Call ButtonTool1 click handler method
      return true;
     }

     return base.ProcessDialogKey( keyData );
    }

Children