Jump to content

How to hand over a variable from a GUI to a function?


SpecialK
 Share

Recommended Posts

Hello,

this is my little script:

#include <GUIConstants.au3>
AutoItSetOption("MouseCoordMode", 0)
AutoItSetOption("WinTitleMatchMode", 4)

$Parent = GUICreate("Neuer User - Leicht gemacht V. 0.1", 400, 230)
$user= GUICtrlCreateInput ("Wie lautet Ihr  Nutzername?", 20, 10)
$weiter = GUICtrlCreateButton ("Weiter", 10, 115, 100)
$Ende = GUICtrlCreateButton ("Ende", 160, 200,100)



GUISetState ()

While 1 
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE 
            Exit 
        Case $msg = $weiter
            Voelker()
        case $msg = $Ende 
            ExitLoop 
    EndSelect
    
Wend 
GUISetState(@SW_HIDE)



Func Voelker() 
Msgbox (1, "Test", $user)

The Messagebox in the Function "Voelker" only gives me a "3" or something else. But not that, what i have wrote in the Input-Box in the GUI. I think i have a problem to hand over the variable $user from the GUI to the Funkction.

Can anyone help me?

SpecialK

Link to comment
Share on other sites

Try

#include <GUIConstants.au3>
AutoItSetOption("MouseCoordMode", 0)
AutoItSetOption("WinTitleMatchMode", 4)

$Parent = GUICreate("Neuer User - Leicht gemacht V. 0.1", 400, 230)
$user= GUICtrlCreateInput ("Wie lautet Ihr  Nutzername?", 20, 10)
$weiter = GUICtrlCreateButton ("Weiter", 10, 115, 100)
$Ende = GUICtrlCreateButton ("Ende", 160, 200,100)



GUISetState ()

While 1 
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE 
            Exit 
        Case $msg = $weiter
            Voelker()
        case $msg = $Ende 
            ExitLoop 
    EndSelect
    
Wend 
GUISetState(@SW_HIDE)



Func Voelker() 
Msgbox (1, "Test", GUICtrlRead($user))
EndFunc


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

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