Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography



Maxunderground news unavailable

Maxscript Rollouts & Dialogs...
show user profile  ccampbell
Hey Guys, Long time no post. Been working on my new business for the last year so my attendence here has been limited though business is doing well!

I am working on a script that requires one dialog to affect another.

Example: I want to pop up a dialog box with a button from a rollout, check a few boxes or type some info into a text box then submit that dialog, closing the new dialog and adding the new details to a field in the original rollout.

I've thought of a few lengthy solutions but i'm hoping there is a way to do it directly within max script without writing/reading text files and such. Perhaps a way to send variables and triggers to an open dialog via dialog name? Globals are out unless I can trigger UI events from another dialog.

Any help would be greatly appreciated! Thanks fella's.




$Entrepreneur = if((Designer + Engineer)*Programmer){Problem Solver};



read 454 times
10/7/2014 11:11:57 PM (last edit: 10/7/2014 11:11:57 PM)
show user profile  Garp
One way to do it:



read 442 times
10/8/2014 3:55:56 AM (last edit: 10/8/2014 4:22:50 AM)
show user profile  ccampbell
Garp to the rescue! As usual...

Thanks a ton!. This worked perfectly, I hadn't considered adding the rollout name as a global.

Thanks a ton!




$Entrepreneur = if((Designer + Engineer)*Programmer){Problem Solver};



read 425 times
10/8/2014 5:45:05 PM (last edit: 10/8/2014 5:45:05 PM)
show user profile  Garp
> I hadn't considered adding the rollout name as a global.

You don't have to.
The first two lines are a trick when testing to avoid having to close a dialog before reevaluating the code (to prevent identical dialogs from piling up). It also depends whether it makes sense to have several instances of the same dialog or not.
You do need a forward declaration of one of the rollouts, though. But you could simply type local rlt_master. Note that the code is enclosed in parentheses. Otherwise every declaration at top scope level would be automatically global (not a good idea).




read 418 times
10/8/2014 6:51:58 PM (last edit: 10/8/2014 6:56:09 PM)
show user profile  ccampbell
True, you are definitely correct.

I thought the issue was stemming from the fact that I was creating 2 separate dialog's and saving them as 2 separate scripts. So my thinking was when launching them they had no link to one another. This was not true.

This was a case of user error for sure. Turns out this is what I was doing but there must have been a typo I was missing because everything you did resembled my scripts almost exactly other than your creating the dialog on the fly(was trying to do that btw - thanks ) and the global declaration for the destroydialog try/catch. Hence my thinking the global declaration was the solution ( which btw worked with no changes to my script - weird)

I just tried again separating your scripts into 2 separate dialog s and everything works perfectly.

Thank you again for the help and returning for further clarification - You've been a great help to me in the past, as well. thanks!




$Entrepreneur = if((Designer + Engineer)*Programmer){Problem Solver};



read 413 times
10/8/2014 7:21:23 PM (last edit: 10/8/2014 7:22:29 PM)
show user profile  Nik Clark
Grap for president.

I've said this before.



Click here to send me an emailClick here to visit my websiteClick here to visit my photo gallery on Flickr

read 409 times
10/8/2014 7:26:52 PM (last edit: 10/8/2014 7:32:45 PM)
show user profile  ccampbell
^




$Entrepreneur = if((Designer + Engineer)*Programmer){Problem Solver};



read 405 times
10/8/2014 7:33:58 PM (last edit: 10/8/2014 7:33:58 PM)
show user profile  Garp
:D


> saving them as 2 separate scripts (...) they had no link to one another

Again, this would depend on the scripts being enclosed in their own local scope or not and variables being declared at global scope (or declared explicitly global at local scope).
The base rule is that for any piece of code to access a variable, that variable has to be visible to it.
As for rollout controls, their local objects are accessed like properties with the dot operator.




read 399 times
10/8/2014 8:04:57 PM (last edit: 10/8/2014 8:04:57 PM)
#Maxforums IRC
Open chat window


Support Maxforums.org