Jump to content

Noob Needs Some Help


Recommended Posts

Hey,

I'm making a program that requires a form to be filled out. I'm trying to make a GUI form that has an input box to put your name and a done button that will change the name variable in the code... but it isn't working correctly... here's what I have:

$varname = "xxx"

#include <GUIConstants.au3>
$Form1 = GUICreate("Set Name", 339, 305, 243, 118)
$Done = GUICtrlCreateButton("Done", 136, 152, 75, 25)
$Button2 = GUICtrlCreateButton("Close", 136, 208, 75, 25)
$Input1 = GUICtrlCreateInput("Name Here", 120, 88, 121, 21, -1, $WS_EX_CLIENTEDGE)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exitloop 
    Case $msg = $Done
    $varname = $input1
                Case $msg = $button2
                 exit
    Case Else
    ;;;;
    EndSelect
WEnd

; Test if the variable changed
Msgbox(0, "Test", $varname)

Anyone see whats wrong with this? The message box shows "5" no matter what I enter in the input box ><

Any Help is greatly appreciated :think:

Link to comment
Share on other sites

$varname = "xxx"

#include <GUIConstants.au3>
$Form1 = GUICreate("Set Name", 339, 305, 243, 118)
$Done = GUICtrlCreateButton("Done", 136, 152, 75, 25)
$Button2 = GUICtrlCreateButton("Close", 136, 208, 75, 25)
$Input1 = GUICtrlCreateInput("Name Here", 120, 88, 121, 21, -1, $WS_EX_CLIENTEDGE)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Done
            $varname = GUICtrlRead($Input1)
        Case $msg = $Button2
            ExitLoop
        Case Else
        ;;;;
    EndSelect
WEnd

; Test if the variable changed
MsgBox(0, "Test", $varname)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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...