Is there a way to define callback when a script window closes

Is there a way to define callback when a script window closes

e_juma
Enthusiast Enthusiast
1,040 Views
5 Replies
Message 1 of 6

Is there a way to define callback when a script window closes

e_juma
Enthusiast
Enthusiast

In the document for script command 'window'. it only has a callback for minimize. But there is no way to set a callback when window close. Who knows how to make it?

0 Likes
1,041 Views
5 Replies
Replies (5)
Message 2 of 6

korama20
Explorer
Explorer

I’m also looking for an answer to this question.

0 Likes
Message 3 of 6

malcolm_341
Collaborator
Collaborator

Yes you define it in the window creation like this

window -title myWindow -sizeable true -resizeToFitChildren true -closeCommand "myGlobalProc();" myWindow_name;
0 Likes
Message 4 of 6

malcolm_341
Collaborator
Collaborator

Sure it looks like this, but the myGlobalProc was just a dummy procedure to do whatever you want, rename it and put whatever code you want to execute in there.

 

 

global proc myGlobalProc()
{
     print "You closed the window\n";
}

window -title myWindow -sizeable true -resizeToFitChildren true -closeCommand "myGlobalProc();" myWindow_name;

 

0 Likes
Message 5 of 6

Hans_Redman
Advocate
Advocate

.

0 Likes
Message 6 of 6

malcolm_341
Collaborator
Collaborator

It won't, the name of this thread is "Is there a way to define callback when a script window closes" that code will run when the window closes. There's nothing mentioned in this thread about saving preferences. Are you a bot maybe?

0 Likes