Jump to content

Use keyboard shortcut for GUICtrlCreateButton?


Go to solution Solved by emendelson,

Recommended Posts

I have a GUI with buttons labeled Yes and No. I think it should be obvious to me how to let the user press "Y" or "N" to activate the buttons, but I don't see how. Here is a fragment of my code, but I can't figure out how to make "Y/y" or "N/n" do the same thing as clicking the button. Can anyone show me what I should have figured out long ago?

 

Local $doYes = GUICtrlCreateButton("Yes", 200, 5, 50)
Local $doNo = GUICtrlCreateButton("No", 260, 5, 50)

$doConvert = 0

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $doYes
            $doConvert = 1
            ExitLoop
        Case $doNo
            $doConvert = 0
            ExitLoop
    EndSwitch
WEnd

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...