TextField to String

How do i take the tekst from af tekstfield and put it in af string when the enter key is pressed?
For eksample:

window -t "Funktion Editor" funktion;
columnLayout ColumnLayout;
textField;
showWindow funktion;

// Makes a tekst Field

When i write something in the tekst field and press Enter i want the text that i just wroth to be assigned to af string like:

string $text = "Tekst from Teksfield"

Anyone who knows how?

Thanks

First you'll want to make it a textFieldGrp that way you can give your text field a name.

textFieldGrp -switches myText;

then, when you want to put the text into a variable you can query that field by name:

string $var = textFieldGrp -q -tx myText;

-James