Sign in to follow this  
Followers 0
SpecialK

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

3 posts in this topic

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

Share this post


Link to post
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


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

Ok, thank you. I knew it was only a little stupid problem :P

SpecialK

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