Jump to content

Recommended Posts

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

;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 post
Share on other sites

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 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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...