Subscribe Bookmark RSS Feed

List Box Recall

robot

Community Trekker

Joined:

Feb 27, 2012

Hi,

I am trying to create a Recall button, but I am having trouble getting it to work on a List Box.  I read the excellent example 46984 - How to create a Recall button on a custom window, and I am still having trouble.  I am using JMP12, but I hope the solution will work down to JMP10.  Any ideas?

// Example

Names Default To Here( 1 );

New Window( "Example",

       <<Modal,

       lb = List Box( {"Yes", "No", "Maybe"}, Max Selected( 1 ) ),

       Text Box( "" ),

       Button Box( "OK",

             ::recall = [=> ];

             ::recall << Insert( "lb", lb << Get Selected );

             lbVal = lb << Get Selected;

             Print( ::recall );

             Print( lbVal );

       ),

       Button Box( "Reset",

             ::recall = [=> ];

             ::recall << Insert( "lb", lb << Get Selected );

             lb << Clear Selection;

             Print( ::recall );

             Print( lbVal );

       ),

       Button Box( "Recall",

             lb << Clear Selection;

             lb << Set Selected( ::recall["lb"] ); // This is not working.  Why?

             // lb << Set Selected( 2 ); // This will work, but I do not want to use a number

             // because the names and / or order of the List Box options may change.

             Print( ::recall );

             Print( lbVal );

       ),

       Button Box( "Cancel",

             Print( ::recall );

             Print( lbVal );

       )

);

3 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

I placed an entry in the File Exchange that provides a piece of code that contains a very complete user entry dialog box, with recall, help, etc.  You should be able to cut it out of the script, and use it, or use it as a model for your own code.  It handles all of the recalls of list boxes, text and numeric boxes, check boxes, etc.

Go to the File Exchange and search for:

     Runs Test (Wald-Wolfowitz Test) and JSL Implementation of JMP Platform Dialog Box

Jim
robot

Community Trekker

Joined:

Feb 27, 2012

Hi Jim,

Thank you for the reply.  I read through the Runs Test script, but I did not find an example of a List Box recall.  It is possible I missed it in the large script.  I was able to find a work-around solution.

// Example

Names Default To Here( 1 );

New Window( "Example",

       <<Modal,

       lb = List Box( {"Yes", "No", "Maybe"}, Max Selected( 1 ) ),

       Text Box( "" ),

       Button Box( "OK",

             ::recall = [=> ];

             ::recall << Insert( "lb", lb << Get Selected );

             lbVal = lb << Get Selected;

       ),

       Button Box( "Reset",

             ::recall = [=> ];

             ::recall << Insert( "lb", lb << Get Selected );

             lb << Clear Selection;

       ),

       Button Box( "Recall",

             lb << Clear Selection;

             lb << Set Selected( Contains( lb << Get Items, ::recall["lb"][1] ) ); // Set List Box.

       ),

       Button Box( "Cancel" )

);

txnelson

Super User

Joined:

Jun 22, 2012

Looks great

Jim