Jump to content
Sign in to follow this  
nitro322

Cannot click OK button, but activating with keyboard works

Recommended Posts

I have an odd problem with a simple GUI I've created.  It has two buttons - one OK and one Cancel, with OK set as the default button.  Everything works except for clicking the OK button.  Specifically:

 

If I press enter anywhere in the form, OK fires.

If I tab to OK and hit space, OK fires.

If I tab to Cancel or close the window, Cancel fires.

If I click Cancel, Cancel fires.

If I click OK... nothing happens.  Can't for the life of me figure out what's causing that. 

 

Any idea what I'm overlooking?  Here's the form:

 

    GUICreate("Set Password", 195, 110)

    ; Draw elements
    GUICtrlCreateLabel("Set new password:", 5, 5, 90, 20)
    local $pass1in = GUICtrlCreateInput('', 100, 5, 90, 20, $ES_PASSWORD )
    GUICtrlCreateLabel("Confirm password:", 5, 25, 90, 90)
    local $pass2in = GUICtrlCreateInput('', 100, 25, 90, 20, $ES_PASSWORD )
    local $ok = GUICtrlCreateButton("&OK", 10, 85, 80, 20)
    local $cancel = GUICtrlCreateButton("&Cancel", 105, 85, 80, 20)

    ; Set properties
    GUICtrlSetState($ok, $GUI_DEFBUTTON)

    ; Display GUI and wait for action
    GUISetState(@SW_SHOW)
    while 1
        $action = GUIGetMsg()
        select
            ; Begin processing options
            case $action == $ok

                ; Validate input
                msgbox(0, 'test', 'OK button pressed 1')
               GUIDelete()
               exitloop

            ; Exit if Cancel clicked or window closed
            case $action == $GUI_EVENT_CLOSE OR $action == $cancel
                GUIDelete()
                return('')
        endselect
        sleep(10)
    wend
Would appreciate any assistance, because I'm stumped.

Thanks.

Edited by nitro322

Share this post


Link to post
Share on other sites

This label statement overlays the OK button:

GUICtrlCreateLabel("Confirm password:", 5, 25, 90, 90)

Change it to

GUICtrlCreateLabel("Confirm password:", 5, 25, 90, 20)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-07-31 - Version 1.4.12.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-07-31 - Version 1.4.12.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...