Maya Training

Introduction to Hard Surface Modeling

Maya Training

Interiors and Furniture Vol 1 & 2 - Modeling & Cloth

Maya Training

Shading, Lighting and Rendering the Bedroom in MR

Maya Training

Robot volume one - Modeling with animation in mind

Maya Training

Spach-Alspaugh House the complete courseware

Maya Training

Burt The Cartoon Dinosaur Vol 01 - Modeling

New Maya Training

Robot Volume 02 - Hybrid Rigging
You are here > Home > SimplyMaya Community Forums
Loading

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 02-11-2003, 08:50 AM   #1
nspiratn
Registered User
 
nspiratn's Avatar
 
Join Date: Dec 2002
Location: CA
Posts: 211
Thanks: 0
Thanked 0 Times in 0 Posts
Default passing variables to a proc

I'm trying to pass the objectname of the radioButtonGrp to the myProc procedure. But I keep getting an error that $rButton is an undeclared variable. What am I doing wrong?

global proc myProc(string $rButton)
{
string $rButton;
int $nameButton;
$nameButton = `radioButtonGrp -q -sl $rButton`;
print $nameButton;
}

global proc TestGUIscript()
{
string $rButton;
string $window = `window -wh 400 500 -title "Radio Test"`;
rowLayout -nc 3;
text " ";
$rButton = `radioButtonGrp -numberOfRadioButtons 2 -label1 "Hierarchical" -label2 "Alphabetical"`;
print $rButton;
radioButtonGrp -edit -onCommand "myProc($rButton)" $rButton;
showWindow $window;
}

Thanks.
__________________
~nspiratn
nspiratn is offline   Reply With Quote
Old 02-11-2003, 12:33 PM   #2
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

First of all, I usually give controls names rather than rely on the ones that maya assigns. Makes life a lot easier

Anyway, in your myProc you have defined $rButton twice. Also you're missing some parenthesis and whatnot in your radioButtonGrp -edit line...

This should work:
Code:
global proc myProc(string $rButton)
{
	int $nameButton;
	$nameButton = `radioButtonGrp -q -sl $rButton`;
	print $nameButton;
}

global proc TestGUIscript()
{
	string $rButton;
	string $window = `window -wh 400 500 -title "Radio Test"`;
	rowLayout -nc 3;
	text " ";
	$rButton = `radioButtonGrp -numberOfRadioButtons 2 -label1 "Hierarchical" -label2 "Alphabetical"`;
	radioButtonGrp -edit -onCommand ("myProc(\"" + $rButton + "\")") $rButton;
	showWindow $window;
}
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 02-11-2003, 12:41 PM   #3
nspiratn
Registered User
 
nspiratn's Avatar
 
Join Date: Dec 2002
Location: CA
Posts: 211
Thanks: 0
Thanked 0 Times in 0 Posts
Default

COOL! Thanks a lot

YAAAAAAAY!
__________________
~nspiratn
nspiratn is offline   Reply With Quote

A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2015 SimplyMaya - vBulletin® Copyright © 2000-2015, Jelsoft Enterprises Ltd.