Sign in to follow this  
Followers 0
nitro322

Cannot click OK button, but activating with keyboard works

4 posts in this topic

#1 ·  Posted (edited)

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks, water. That was it. I was actually thinking I might have something on top of that button that was interfering with the click, but couldn't spot the issue.

Thanks again. Much appreciated.

Share this post


Link to post
Share on other sites
:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

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  
Followers 0