multiple commands button


#1

Hi,

I’m kind of new to MEL, and I was wondering if someone could point me in the right direction with a UI I’m working on.

Basically, I want to be able to close a window and perform an action at the same time.

I was following this thread:

http://forums.cgsociety.org/showthread.php?f=89&t=287203&highlight=multiple+commands
which seems to be very much like what I wanted, except that my “OK” function is a string.

Here’s what I’ve got:



$Window = `window -title "Window"
-iconName "Locator"
-widthHeight 200 50`;
columnLayout;
 
	$OK = ("deleteUI " + $Window);
	

	button -label "OK" -command  $OK;
   
	showWindow $Window;





global proc Proc2( ) 

{

spaceLocator -p 0 0 0;

}




How do I get it to run Proc2 while closing the window?

Thanks in advance for the help.


#2
button -label "OK" -command  "$OK; Proc2;";

That should work for ya. The command flag in the button command is like a string of mel, you can do anything in it, you don’t even need to make procs if you don’t want. But procs are the way to go anyway.


#3

hmm, it’s still giving me a syntax error.

// Error: $OK; Proc2; //
// Error: Syntax error //


#4

This is your fix, let me know if you need an explanation.


	$OK = ("deleteUI " + $Window + "; Proc2;");


#5

Thanks, that worked perfectly!


#6

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.