Message 1 of 7
Not applicable
07-13-2021
01:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to change out some text in the UI from an array by pressing a button, but I get the error "$names" is an undeclared variable. Please let me know what I am doing wrong here:
//procedure goes first
global proc UseArray()
{
//define variables
string $names[] = {"Bob", "Jim", "Linda", "Susan"};
int $index;
$index +=1;
}
//make the window
string $window = `window -title "Choose Name"`; // declares a variable name for the window
columnLayout; // defines the layout type
text -label $names[$index];
button -label "ChangeName" -command "UseArray"; // Use the procedure here as button command
showWindow $window;
Solved! Go to Solution.