Creating a Shortcut for a Button in a PowerShell GUI

While most of us are all still friends with the mouse in GUIs, keyboard shortcuts once learned are very effective ways of manipulating form controls quicker.

Serveral controls, such as buttons can use keyboard accelerators. This is simply done by prefixing the Text property of the control by an ampersand. By doing this, you can perform the same as the Click event for that control simply by holding down the ALT key on the keyboard, and then the appropriate letter.

For example, a button control with its text property set to &OK will respond to the keyboard combination ALT + O as if the mouse had clicked on it. In keeping with normal Windows functionality, you can identify the keyboard shortcut by holding down the ALT key, and the letter for the accelerator will be listed with an underline.

Here’s how you’d do this in PowerShell Studio :

Keyboard Shortcut

And in PowerShell code itself, this is represented as :

One thought on “Creating a Shortcut for a Button in a PowerShell GUI

  1. I have been exploring for a little bit for any high-quality articles
    or blog posts in this kind of area . Exploring in Yahoo I ultimately stumbled upon this website.
    Studying this information So i’m happy to express that
    I’ve a very excellent uncanny feeling I found out exactly what I needed.
    I such a lot without a doubt will make certain to don?t disregard this web site and give it a look regularly.

Leave a Reply

Your email address will not be published. Required fields are marked *