OminousIdol Posted September 8, 2004 Share Posted September 8, 2004 Well I tired to read from a Input box from the GUI! Every time I have a Mesage box display the value in the Input Box i get a 4 instead of what was in their! I even try the example they give for GUIRead() I get a 4 too??? Whats? My Code expandcollapse popup;Create GUI GUICreate("Game", 800, 600, 0, 0) ;Create Buttons GUISetControl("button", "New", 10, 50, 80, 30) GUISetControl("button", "Load", 10, 85, 80, 30) GUISetControl("button", "Save", 10, 120, 80, 30) ;Show GUI GUIShow() GUIWaitClose() ;New Function If GUIRead("New") Then Call("cChara") Else GUIShow() GUIWaitClose() EndIf ;Function Create Character Func cChara() ;Create Character Creation GUI GuiCreate("Create Character", 800, 600, 0, 0) ;Create Text Boxes GUISetControl("input", "Name", 10, 10, 150, 25) GUISetControl("button", "Save", 10, 50, 80, 30) ;Create Save Function GUIShow() GUIWaitClose() If GUIRead("Save") Then MsgBox(0, "test", GUIRead("Name")) EndIf EndFunc Have no clue whats going on so if somone could tell me how to read from a Input Box from the GUI that would be great! Thanks OminousIdol Link to comment Share on other sites More sharing options...
redndahead Posted September 8, 2004 Share Posted September 8, 2004 $NameInput = GUISetControl("input", "Name", 10, 10, 150, 25) ... GuiRead($Name) Try something more like this red Link to comment Share on other sites More sharing options...
OminousIdol Posted September 8, 2004 Author Share Posted September 8, 2004 Variable used without being declared! Thats what I keep getting where are you getting $Name from anways? From the input text box but never declared that? I dont know what I am doing wrong but still does not work ! Thanks OminousIdol Link to comment Share on other sites More sharing options...
SlimShady Posted September 8, 2004 Share Posted September 8, 2004 It should be $NameInput = GUISetControl("input", "Name", 10, 10, 150, 25) ... GuiRead($NameInput) Link to comment Share on other sites More sharing options...
Valik Posted September 8, 2004 Share Posted September 8, 2004 GuiSetControl() returns a reference to the control. This reference must be used in calls like GuiRead() or GuiWrite() (Anywhere that you see controlref, in fact). You need to create a global variable (So that it will be in scope across functions). Store the control reference as returned by GuiSetControl() in that variable, then use that variable whenever you want to access the contents of that control. Link to comment Share on other sites More sharing options...
redndahead Posted September 9, 2004 Share Posted September 9, 2004 Thanks slimshady for correcting my bad code red 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