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
270
Save customized shortcuts of tool
posted

Hello everybody,

I have the problem, that I want to save customized shortcuts of tools. That means, that when I change the shortcut of a tool in runtime, that changed shortcut will be set the next time i open the form with that tool.

For that I use the Method SaveAsXml(Stream, bool) of my UltraToolbarsManager. But when I extend my toolbars and add  tools to my toolbars in design time, the tools will not be in my toolbarsmanager, because the saved settings will destroy them. That is not acceptable for my clients and me, when we make updates.

Another try is, that I save the important properties of my tools and toolbars by myself and set them when I load my form the next time. But then I have the following problem:

It seems that there are two properties in ToolBase, that handels shortcuts. The first on is ShortcutResolved, that only has a getter. The second one is SharedPops.Shortcut. This property has a setter, but when I use it, I loose my default shortcut that I set in design time:

1. In design time I set F5 as shortcut of a tool.

2. In run Time I customize the tool and F1 is my new shortcut.

3. When the form with my tool is closed, i save F1 as the Shortcut.

4. When I load my form next time, I set SharedProps.shortcut = F1

5. When I want to reset the Shorcuts of my tools by using the toolbarsmanager's customize dialog,  the shortcut will still by F1, where I want to get F5 again.

So is it possible to change ShortcutResolved, so that I can keep the shortcut of design time in SharedProps.Shortcut?

 

Torben

 

Parents
  • 44743
    Verified Answer
    posted

    The first issue you're talking about is caused by the fact that the UltraToolbarsManager does not yet support layout merging. So when you load a layout file, all current tools, toolbars, and ribbon items are cleared and the contents are loaded from the layout file. This causes you to lose any new tools added after the layout file was saved. You can submit a feature request for layout merging. I know it has already been submitted, but the number of request does play a part in what gets implemented in each release.

    As for saving and loading the shortcuts manually, you cannot change the ShortcutResolved, but what that resolution process does is first check the SharedProps.CustomizedShortcut. If that is not set, then it uses the SharedProps.Shortcut. So in your case, you would want to save and load the CustomizedShortcut property, not the Shortcut property. The Shortcut property is what you set at design time.

Reply Children
No Data