if (`window -ex ExampleWindow5`)
deleteUI ExampleWindow5;
window -wh 200 100 -t "Test Window" ExampleWindow5;
columnLayout;
string $button = `button -l "Initial Label"`;
button -edit -command ("changeButtonLabel " + $button) $button;
showWindow ExampleWindow5;
proc changeButtonLabel(string $whichButton)
{
string $labelA = "New Label A";
string $labelB = "New Label B";
string $currentLabel;
$currentLabel = `button -query -label $whichButton`;
if($currentLabel != $labelA)
button -edit -label $labelA $whichButton;
else
button -edit -label $labelB $whichButton;
}