Quick problem using textField

Quick problem using textField

Anonymous
Not applicable
498 Views
2 Replies
Message 1 of 3

Quick problem using textField

Anonymous
Not applicable
Hi,


I'm trying to make a simple GUI that contains a textField and a button. When I press the button, I want to print what is in the textField. I think I'm missing something simple. How do I correctly pass the text from the field to the variable?

Thanks!

Tony

____________________________________________________________________



// Make a window

string $window = `window -title "Name Tool"
-iconName "NmTl"
-widthHeight 200 55`;
columnLayout -adjustableColumn true;

text -label "enter your name";
string $tlName = `textField` ;


button -label "Print Name" -command "tlPrintName $tlName" ;
button -label "Close" -command ("deleteUI -window " + $window)

setParent ..;
showWindow $window;



// Proc that prints the field

global proc tlPrintName ( string $tlName ) {

print $tlName ;


}
0 Likes
499 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Make that

// Proc that prints the field
global proc tlPrintName ( string $tlName ) {
print `textField -q -text $tlName`;
}
0 Likes
Message 3 of 3

Anonymous
Not applicable
That worked great. Thank you!
0 Likes