kenedy Posted November 21, 2004 Share Posted November 21, 2004 Look at this example code. How is that possible that myFunc can access $input2 value? I don't pass it as argument. #include <guiconstants.au3> ShowGUI() Func ShowGUI() GUICreate("My GUI") $Input1 = GUICtrlCreateInput ( "text1", 10, 10) $Input2 = GUICtrlCreateInput ( "text2", 10, 30) $Input3 = GUICtrlCreateInput ( "text3", 10, 50) GUISetState (@SW_SHOW) $msg = GUIGetMsg() myFunc($input1,$input3) EndFunc Func myFunc ($first,$second) For $i = $first to $second MsgBox (0,"",GUIRead ( $i )) Next EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted November 21, 2004 Developers Share Posted November 21, 2004 (edited) Look at this example code.How is that possible that myFunc can access $input2 value? I don't pass it as argument. <{POST_SNAPBACK}>Myfunc doesn't access $input2.This will be the values for $input?;$input1 = 1$input2 = 2$input3 = 3You tell MyFunc to retrieve the values for control 1 to 3.MyFunc itself does the retrieval itselve for the 3 controls. Edited November 21, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
jpm Posted November 21, 2004 Share Posted November 21, 2004 Look at this example code.How is that possible that myFunc can access $input2 value? I don't pass it as argument. #include <guiconstants.au3> ShowGUI() Func ShowGUI() GUICreate("My GUI") $Input1 = GUICtrlCreateInput ( "text1", 10, 10) $Input2 = GUICtrlCreateInput ( "text2", 10, 30) $Input3 = GUICtrlCreateInput ( "text3", 10, 50) GUISetState (@SW_SHOW) $msg = GUIGetMsg() myFunc($input1,$input3) EndFunc Func myFunc ($first,$second) For $i = $first to $second MsgBox (0,"",GUIRead ( $i )) Next EndFunc<{POST_SNAPBACK}>define $input2 as a global variable at the begining of your script Link to comment Share on other sites More sharing options...
kenedy Posted November 21, 2004 Author Share Posted November 21, 2004 JdeBI understand now. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now