PDA

View Full Version : can a button pass information to a procedure?


tinitus
03-11-2009, 04:53 PM
I wrote a script in which I created buttons with a for loop..
each button shall now execute the same procedure but with different attributes..
is there a way to pass information(e.g. string variables) from this created button to my procedure?

thx!

mlefevre
03-11-2009, 05:48 PM
Hey,

I'm not sure if this is the sort of thing you're after.

When you create a procedure, you can add arguments to feed in information.

if (`window -exists myWindow`)
deleteUI myWindow;

window
myWindow;

columnLayout
mainCol;

button
-label "Name Printer"
-command "printName(\"Steve\")"
button01;

button
-label "Name Printer"
-command "printName(\"John\")"
button02;

showWindow myWindow;



global proc printName (string $name){
print ($name + "\n");
};

Good luck!

-matt

tinitus
03-12-2009, 09:19 PM
oh thank you so much..you saved my day!

CGTalk Moderation
03-12-2009, 09:19 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.