Jump to content

Function Remember


 Share

Recommended Posts

I was wondering

If I had a script that did this

GUICreate("test", 261.5, 275)
$Key = GUICtrlCreateInput("" , 0, 255, 230, 21)
$Gen = GUICtrlCreateButton("Gen", 232, 255, 30, 21, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Gen
            _test()
    EndSwitch
WEnd

Func _Test()
    $Keys[1] = "line 1"
    $Keys[2] = "line 2"
    $i = 0+1
    GUICtrlSetData($Key , "")
    GUICtrlSetData($Key , $Keys[$i] , "Error")
EndFunc

how can I make it remember what key it did already so it will move on to the next

so if the first key is done ($keys[1] = "line 1")

It will remember that until its push again then it

will clear input and put the second key

I tried messing with variables that told it what ones were done but didn't work well

Link to comment
Share on other sites

GUICreate("test", 261.5, 275)
$Key = GUICtrlCreateInput("" , 0, 255, 230, 21)
$Gen = GUICtrlCreateButton("Gen", 232, 255, 30, 21, 0)
GUISetState(@SW_SHOW)
Global $i = 0
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Gen
            _test()
    EndSwitch
WEnd

Func _Test()
    $Keys[1] = "line 1"
    $Keys[2] = "line 2"
    $i +=1
    GUICtrlSetData($Key , "")
    GUICtrlSetData($Key , $Keys[$i] , "Error")
EndFunc

Edited by Paulie
Link to comment
Share on other sites

GUICreate("test", 261.5, 275)
$Key = GUICtrlCreateInput("" , 0, 255, 230, 21)
$Gen = GUICtrlCreateButton("Gen", 232, 255, 30, 21, 0)
GUISetState(@SW_SHOW)
Global $i = 0
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Gen
            _test()
    EndSwitch
WEnd

Func _Test()
    $Keys[1] = "line 1"
    $Keys[2] = "line 2"
    $i +=1
    GUICtrlSetData($Key , "")
    GUICtrlSetData($Key , $Keys[$i] , "Error")
EndFunc
thanks would

$i = 1+ also work?

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