Hello people,
i have 2 textfield paths stored into an array.
I'd like to fill in the first textfield (index [0]) with the content of a variable. I'd like to specifically write the value from the variable , at the location of the first textfield which is stored into a variable like $textFieldPath[0]
Does anyone which is the command to achieve that?
Thank you very much for your help!
Hello,
I'm sorry, I'm not sure if I understood correctly want you want to do. Maybe you just want to change the text of a textField? For this you simply have to call the textField command with "-edit" to edit an existing text field and "-text" to change the text. In the end you specify the name of your text field, which is in your case from an array variable. When you want to read from a text field you have to use "-query -text". I hope I could help you.
global proc Test() { string $window = `window`; rowColumnLayout -numberOfColumns 2 -columnWidth 1 200 -columnWidth 2 200; string $textFields[2];
// Create text fields and store their names in an array $textFields[0] = `textField "Test0"`; $textFields[1] = `textField "Test1"`; string $variable0 = "Hello"; string $variable1 = "World";
// Change the text of the text fields textField -edit -text $variable0 $textFields[0]; textField -edit -text $variable1 $textFields[1]; showWindow $window; } Test();