cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
vince_faller
Super User (Alumni)

Exactly Recreate a new window() in its exact state

I'm creating a dynamic new window() with x amount of tabs and charts (other stuff).  Is there anything like Eval(dt << Get Script) that will recreate the window exactly?  Keeping all buttons functions fully intact and knowing where I was effectively.

Right now if I do it, I can't even get it to create using the eval(nw<<Get Script).

Edit*  Just to be clear.  I'm trying to recreate a window without knowing exactly what's inside of it. This is the example I came up with to show what I'm talking about:

Names default to here(14);

cwd = convert file path("./");

New window("Test",

       Hlistbox(

              tb = tabbox(

                           "Tab1",

                           Panelbox("Tab 1",

                           lb = listbox(filesindirectory("$SAMPLE_DATA")),

                           buttonbox("Open",

                                  file = (lb << Get Selected)[1];

                                  dt = Open("$SAMPLE_DATA\"||file)

                           )

                     ),

              )

       ),

       Hlistbox(

              Buttonbox("Back", tb<<Set Selected((tb << Get Selected)-1)),

              Buttonbox("Next",

                     newtab = Eval(other_boxes[(tb<<Get Selected)]);

                     tb<<Append("Tab", newtab);

                     tb<<Set Selected((tb<<GetSelected)+1)

              )

       )

);

other_boxes = {

       PanelBox("Blank, because ... reasons?"),

       PanelBox("Column Names",

              Collistbox(dt, all)

       )

      

};

It seems the general concensus is no.  So I'll just mark it as answered. 

Vince Faller - Predictum
16 REPLIES 16
vince_faller
Super User (Alumni)

Re: Exactly Recreate a new window() in its exact state

I don't know if you've ever used emulators at all for old nintendo games or not, but this uses something called a save state which is analogous to this.

What I want is a save state. Something that saves exactly what level I am on, where I am on the screen, etc.  Telling me to just restart the game is not what I'm looking for. 

This method solves a different problem.  I don't see how that's helpful to this. 
Agree to disagree I guess. I meant no offense.  Sorry for not explaining myself correctly originally.

Vince Faller - Predictum
msharp
Super User (Alumni)

Re: Exactly Recreate a new window() in its exact state

I'm sorry, I didn't realize you were building a video game.  As such, I'd recommend to first focus on building the game engine, it would be a simple matter after that to build into it save states.

For others reading this forum that want a simpler way to recreate a window and also don't understand the methodology.  I've attached a more complex example that demonstrates the robustness and simplicity.


You'll run recreateWindow.jsl which will prompt you for the path to recreateWindow2.jsl.

Let me know if you any questions running these files.

vince_faller
Super User (Alumni)

Re: Exactly Recreate a new window() in its exact state

Nope, not creating a video game.  Hence the word analogous. Here's an example :

Names default to here(14);

cwd = convert file path("./");

New window("Test",

       Hlistbox(

              tb = tabbox(

                           "Tab1",

                           Panelbox("Tab 1",

                           lb = listbox(filesindirectory("$SAMPLE_DATA")),

                           buttonbox("Open",

                                  file = (lb << Get Selected)[1];

                                  dt = Open("$SAMPLE_DATA\"||file)

                           )

                     ),

              ),

              Buttonbox("Recreate",

                    

                     tabCounter = 1;

                     text_list = {""};

                     include(cwd||"/recreateWindow2.jsl")

              )

       ),

       Hlistbox(

              Buttonbox("Back", tb<<Set Selected((tb << Get Selected)-1)),

              Buttonbox("Next",

                     newtab = Eval(other_boxes[(tb<<Get Selected)]);

                     tb<<Append("Tab", newtab);

                     tb<<Set Selected((tb<<GetSelected)+1)

              )

       )

);

other_boxes = {

       PanelBox("Blank, because ... reasons?"),

       PanelBox("Column Names",

              Collistbox(dt, all)

       )

      

};

Now when I run this I get something like this when I run next to what I get when I press recreate.

   

Here's after I select a data table and open it then press next.

 

Here's when I press next again.

  

Now I'd have you mark the differences between the left and right images.   When I say this doesn't work, it's because I tried it.  Unless I am misunderstanding what you call working or how to use your script.  But my expectation is that the right should look exactly like the left (assuming I've opened the proper data tables).  Not only that but all the buttons in all the tabs should also work. 

Vince Faller - Predictum
msharp
Super User (Alumni)

Re: Exactly Recreate a new window() in its exact state

Sorry, I was being facetious.  I knew you weren't creating a video game. 

Next, my example shows a methodology and is stand alone.  I didn't create a magic button for you.  You can't just steal a methodology.  It makes me laugh that you thought you could just throw my code into yours code and expect it to work.  But to answer you, the windows on the right never change, and it looks like the code is replicating that window exactly every time.  You'd need to compare top to bottom.

I'm not paid to help people on these forum's and I'm out of patience.  I'd suggest you go back, actually read the code and understand what it's doing.  I hope you the best.

vince_faller
Super User (Alumni)

Re: Exactly Recreate a new window() in its exact state

Thanks you.  Enjoy. 

Vince Faller - Predictum

Re: Exactly Recreate a new window() in its exact state

I have written a script that captures which tab was selected as well as the values of Text Edit Boxes, Number Edit Boxes, Combo Boxes, and List Boxes and stores them in a global 2-dimensional array when the window closes. When the window opens, the values are set to the values captured when the window was closed.

I have included an example window in the script to show the functionality, but the getValues and setValues functions are what is used to capture the state and reset the state when the script is run again.

Limitations:

1. This code does not take into account any dynamically created display boxes. You would need to adjust the code to account for that.

2. This code does not re-run any of your platforms. You can adjust the code as necessary to do that.

3. When you close JMP, the state is lost. You can, however, save the array in a text file rather than a global variable and the values can be retrieved across all instances of JMP.

4. I have not implemented check boxes in this script (and any other display boxes that I am forgetting).

The script is attached.

Let me know if you have any questions about the script.

Justin
vince_faller
Super User (Alumni)

Re: Exactly Recreate a new window() in its exact state

Thanks,  it's useful but it only gets the selected values from it.  I'm looking more for a duplication of the window itself. 

Vince Faller - Predictum