Jump to content

Recommended Posts

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
Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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
  • Recently Browsing   0 members

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