Changing Shortcuts

Stimulsoft Reports.NET discussion
Post Reply
DanielR
Posts: 2
Joined: Mon Oct 16, 2017 9:16 am

Changing Shortcuts

Post by DanielR »

Hello Stimulsoft Team,

We are using your reports embedded in our own Software, therefore I made a inheritance of the StiViewerControl.
Now I'm trying to change some Shortcuts in my Class, because I need the F7-Button(normaly used as "SearchNext") for our own Software.
I would like to change the Shortcut of the "SearchNext"-Button to F3 and remove the shortcuts for the "ZoomOnePage"(F3)- and "ZoomTwoPages"(F4)-Button.

I tried the following Code:

Code: Select all

public partial class clsStiViewer : Stimulsoft.Report.Viewer.StiViewerControl
    {
        public clsStiViewer()
        {
            InitializeComponent();

            // Remove the old Shortcuts
            this.View.viewerControl.ToolBar.Items["icZoomPages"].SubItems["tbZoomOnePage"].Shortcuts[0] = Stimulsoft.Controls.Win.DotNetBar.eShortcut.None;
            this.View.viewerControl.ToolBar.Items["icZoomPages"].SubItems["tbZoomTwoPages"].Shortcuts[0] = Stimulsoft.Controls.Win.DotNetBar.eShortcut.None;

            // Set the new Shortcut and change the tooltip
            this.View.viewerControl.FindBar.Items["tbFindNext"].Shortcuts[0] = Stimulsoft.Controls.Win.DotNetBar.eShortcut.F3;
            ((Stimulsoft.Controls.Win.DotNetBar.ButtonItem)this.View.viewerControl.FindBar.Items["tbFindNext"]).AlternateShortCutText = "F3";
        }
    }
While debugging i can see that the Buttons have the right shortcuts ("ZoomOnePage" and "ZoomTwoPages" have no shortcut, "FindNext" has F3) still the Shortcuts don't work.

How can I force the Shortcuts to be changed?

Kind regards
Daniel
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Changing Shortcuts

Post by HighAley »

Hello, Daniel.

Sorry for the delay with answer.
We need some additional time to prepare an answer.

Thank you.

Ticket reference: #3150212
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Changing Shortcuts

Post by HighAley »

Hello, Daniel.

Please, try next code to set necessary shortcuts:

Code: Select all

((Stimulsoft.Controls.Win.DotNetBar.ButtonItem)this.View.viewerControl.ToolBar.Items["icZoomPages"].SubItems["tbZoomOnePage"]).Shortcuts.Clear();
((Stimulsoft.Controls.Win.DotNetBar.ButtonItem)this.View.viewerControl.ToolBar.Items["icZoomPages"].SubItems["tbZoomTwoPages"]).Shortcuts.Clear();
((Stimulsoft.Controls.Win.DotNetBar.ButtonItem)this.View.viewerControl.FindBar.Items["tbFindNext"]).Shortcuts.Clear();
((Stimulsoft.Controls.Win.DotNetBar.ButtonItem)this.View.viewerControl.FindBar.Items["tbFindNext"]).Shortcuts.Add(Stimulsoft.Controls.Win.DotNetBar.eShortcut.F3);
Thank you.
DanielR
Posts: 2
Joined: Mon Oct 16, 2017 9:16 am

Re: Changing Shortcuts

Post by DanielR »

Hello,

the provided code works fine.

Thank you
Daniel
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Re: Changing Shortcuts

Post by Ivan »

Hello,

We are always glad to help you.
Let us know if you need any additional help.

Thank you.
Post Reply