HotKey on a Window

My application has a “hidden” hotkey that opens up a special User Activity screen anytime the user presses Control F12, while on the main menu. In clarion I did this by setting an alert key for the window, then in the Events.AlertKey embed point I tested to see if the Control F12 was pressed and opened the window.  Like this:

IF Keycode() = CtrlF12

So I do that in WinDev? Buttons can have shortcut keys so that’s a start. I created a button, and on the GUI tab, sat its shortcut key to Control F12. I placed my code on the button and it fired whenever the user pressed Control F12.

So then I hid the button, after all the goal was a “hidden” feature. And that is when I found out that the shortcut key is not active when the button is hidden.   hmm…. That’s ok, it just so happens that you can place a control off of the window in WinDev and it doesn’t display and you don’t have to set it to not visible. Sure enough that worked, no button showing and my code fired on Control F12. Then I maximized the window……

And my button appeared.. ahhhrrrggg…..

After a brief tantrum I realized if I placed the button to the right of the window, and set the anchor to move to the right then the button would always remain off the window.

And tada!!!! I had it, a hidden hotkey feature.

So brief recap; place a button to the right of the window, set its anchor to move to the right, set the shortcut key to the key you want, and place your code on the button. That’s all there is to it.

Now, back to your regular schedule program….

3 thoughts on “HotKey on a Window

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s