Jump to content

Recommended Posts

Posted

I have a dialog box with several different controls, among them two input (textbox) controls. I'm able to click every control except ONE of the two input controls. When I click it, I cannot get the cursor to appear in the textbox nor can I change the default text in the textbox. HOWEVER, when I use the Alt key shortcut to access the control, I can change the text via deletion and/or overtyping--BUT I still cannot click into the textbox. What's the problem here? It's probably something easy that I'm overlooking, but, at the moment, I'm stumped. Here's the basic code:

#include <GUIConstants.au3>

Dim $initials
$initials = "hh"
Dim $txtFilename
$txtFilename = ""

$CaptionRecordType = "Choose record type:"
GUICreate ( $CaptionRecordType , 420 , 240 , 0 , 50  )
    GUICtrlCreateLabel ( "Which kind of file to create?", 75, 37, 187, 15 )
    GUIStartGroup()
    $btnItem = GUICtrlCreateRadio ( "&ITEM records", 75, 75, 90, 15 )
    $btnBib = GUICtrlCreateRadio ( "&BIB records", 75, 102, 90, 15 )
    GUICtrlSetState ( $btnItem, $GUI_CHECKED )
    $btnOK = GUICtrlCreateButton ( "OK", 322, 7, 75, 21 )
    $btnCancel = GUICtrlCreateButton ( "Cancel", 322, 37, 75, 21 )
    GUICtrlCreateLabel ( "&Current initials:", 245, 125, 187, 15 )
    $txtbox1 = GUICtrlCreateInput ( $initials, 322, 120, 30, 19 )
    GUICtrlCreateLabel ( "Enter &name to use for this file:", 75, 155, 187, 15 )
    $txtbox2 = GUICtrlCreateInput ( $txtFilename, 75, 175, 187, 19 )
    GUICtrlSetState( -1, $GUI_FOCUS )
;
GUICtrlSetState( $btnOK, $GUI_DEFBUTTON ) ;OK button is the default button
;
GUISetState () ; display the dialog box
;
; run the GUI until the dialog is closed
Do
    $dlgResponse = GUIGetMsg()
;
; process any changes in dialog control values:
    If $dlgResponse = $btnCancel Then ; if Cancel button clicked
        $dlgValue = 0
        ExitLoop
    ;
    ElseIf $dlgResponse = $btnOK Then
        $initials = GUICtrlRead( $txtbox1 )
        $txtFilename = GUICtrlRead( $txtbox2 )
        If $initials = "" Then
            MsgBox(48,"   P R O B L E M", "You MUST enter your initials!")
        ElseIf $txtFilename = "" Then
            MsgBox(48,"   P R O B L E M", "You MUST enter a name to use for this file!")
        Else
            Select
                Case GUICtrlRead( $btnItem ) = $GUI_CHECKED ; ITEM records
                    $dlgValue = 1
                    ExitLoop
                Case GUICtrlRead( $btnBib ) = $GUI_CHECKED  ; BIB records
                    $dlgValue = 2
                    ExitLoop
            EndSelect
        EndIf
    ;
    Else
        $dlgValue = 0 ; value in case "X" button was clicked at upper right
    EndIf
;
Until $dlgResponse = $GUI_EVENT_CLOSE ; clicked "X" button at upper right of dialog
;
GUIDelete() ; destroy dialog box
;
MsgBox(0,"","'" & $initials & "' -- '" & $txtFilename & "'")

Thanks in advance for your help and suggestions!

Harvey

Posted

this shows your overlapping label... messing things up...

Thank you VERY much! I had copied and pasted the lines from the other input control and neglected to change the length of the label for this control. (That was a very clever technique to highlight the label controls in order to find errors!)

Harvey

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
×
×
  • Create New...