// option one, creates a global variable global proc djnQuickCalc_Solve(string $problemField, string $answerField) { string $problem = `textFieldGrp -q -tx $problemField`; string $answer; if ($problem == "cls") $answer = ""; else $answer = eval("float $djnQuickCalc_Answer = " + $problem ); textFieldGrp -e -tx $answer $answerField; } // option two, no global variable, but more work global proc djnQuickCalc_Solve(string $problemField, string $answerField) { string $problem = `textFieldGrp -q -tx $problemField`; string $evalCmd; if ($problem == "cls") { $evalCmd = ("textFieldGrp -e -tx \"\" " + $answerField); }else{ $evalCmd = ( "{" +"float $result = " + $problem + ";" +"textFieldGrp -e -tx $result " + $answerField + ";" +"}" ); } eval($evalCmd); } global proc djnQuickCalc() { string $windowName = "djnQuickCalc"; if (`window -exists $windowName`) deleteUI $windowName; window -t "It's just adorable" $windowName; columnLayout; string $problemField = `textFieldGrp -l "Problem:" -cat 1 "left" 0 -cw 1 50`; string $answerField = `textFieldGrp -l "Solution:" -ed 0 -cat 1 "left" 0 -cw 1 50`; textFieldGrp -e -cc ("djnQuickCalc_Solve " + $problemField + " " + $answerField) $problemField; setParent..; window -e -wh 300 100 $windowName; showWindow $windowName; }