Computer Science Canada

GUI.CreateTextField help

Author:  surfed [ Tue May 31, 2005 12:37 pm ]
Post subject:  GUI.CreateTextField help

code:
    locatexy (250, 160)
    var alias : int
    var name : string

    put "Name:"

    alias := GUI.CreateTextFieldFull (300, 160, 100, "", difficulty, GUI.INDENT, 0, 0)

    name := GUI.GetText (alias)

GUI.Dispose (alias)



1) What i am trying to do is store the word that is typed in the "alias" text field into variable "name".
2) After it stores the name, i want it to get rid of the text field GUI. GUI.Dispose doesn't seem to work because when i go to the next screen and cls, the textfield can still be editted..

Author:  jamonathin [ Tue May 31, 2005 1:33 pm ]
Post subject: 

Did you use Gui.ProcessEvent in a loop? Because other than that your code seems to work. Here's what I got from it.
code:

import GUI
locatexy (250, 160)
var alias : int
var name : string
put "Name:"
proc difficulty (q : string)
    name := q
end difficulty
alias := GUI.CreateTextFieldFull (300, 160, 100, "", difficulty, GUI.INDENT, 0, 0)
var x, y, z : int
loop
    mousewhere (x, y, z)
    exit when GUI.ProcessEvent or z = 1
end loop
GUI.Dispose (alias)
cls %Screen's cleared
locatexy (250, 160)
put "Name: ", name


Author:  surfed [ Tue May 31, 2005 4:43 pm ]
Post subject: 

Thanks ^^, i have another question:

code:
loop
    mousewhere (x, y, z)
    exit when GUI.ProcessEvent or z = 1
end loop


When does it process an event? I have to click a place for it to stop, so if i want it to exit when i press enter, then i use the Input.Keydown command?


: