Consultingwerk Blog

Create custom shortcut combination not contained in the System.Windows.Forms.Shortcut enumeration

by Marko Rüterbories | Oct 07, 2011

The usage of shortcuts is one of the key features to enable the user to use an application completely using the keyboard. When using the OpenEdge Architect we all know that Ctrl + S saves the current changes from for example code files. In an ABL GUI for .NET application this is typically achieved by assigning a shortcut key from the System.Windows.Forms.Shortcut enumeration to a menu item or ribbon tool – no matter if you are using the toolbar and menu components from Microsoft or Infragistics. A common concern of developers moving from the ABL GUI to the GUI for .NET is that the ABL GUI seems to support more combinations of the modifier keys (CTRL, ALT, SHIFT) and regular keys or cursor keys.

Within C# you just combine the desired keys using a bitwise or operator and then cast the result to System.Windows.Forms.Shortcut.

shorcut_code

To achieve the same in the ABL you first have to combine the desired key enum values using the bitwise or operator (Progress.Util.EnumHelper:Or) and cast the result to Int32 (Progress.Util.CastUtil:ToInt32) and convert that into an Enum object of the type (System.Windows.Forms.Shortcut)  using (System.Enum:ToObject). Finally you can cast that object reference to the System.Windows.Forms.Shortcut type.

ABL-Code3

The object referenced in the instance variable oShortcut can then be assigned to for example the Infragistics.Win.UltraWinToolbars.SharedProps:Shortcut property related to a ButtonTool object.

As a slightly more usual example is the following code which creates a shortcut ALT + A, which is typically used by menu mnemonics and thus not foreseen in the Shortcuts collection.

ABL-Code-AltA

3 comments

Leave a comment
  1. kelly Leona | Mar 21, 2019
    Thus while the IronPython instruments for Visual Studio have sat inert on my PC, I'm absolutely open to another apparatus put out by a group at Microsoft called Python Tools for Visual Studio. Why? Since it bolsters CPython, not simply AoneAssignment - Online Assignment Help. The instrument is free and open source, and it works in any of the without non forms of Visual Studio, or with the free, independent Visual Studio Shell. We should step through it for an exam drive.
  2. david | Mar 04, 2019
    The post is really superb. It’s varied accessory information that consists during a basic and necessary method. Thanks for sharing this text. The substance is genuinely composed. This web Tom Cruise Jacket is frequently sharing useful actualities. Keep sharing a lot of posts.
  3. Luke | Mar 01, 2019
    Pablo Picasso can begin this process by halting childhood acts of giving and showing our love in other ways, with an occasional special treat on the side. 

    Leave a comment