Subscribe Bookmark RSS Feed

JMP 8 vs JMP 9 scripting query

Hello,

I'm trying to understand why a simple script is apparently performing differently in JMP 8 and JMP 9. In brief, the script is supposed to allow the user to select the indexes of one, two or several contiguous items in a list box, and then clear the selection completely if more than one has been selected - which is what happens in JMP 8, but not in JMP 9, which appears to return just the highest index and then leaves the corresponding item selected. To see the problem, open the log, run the script and look at the resulting index list whenever more than one item is selected.

BoyList = {"Albert", "Bob", "Chris", "Duncan", "Eddie", "Fred", "Graham", "Hal"};

BoyScript = Expr(

                SelectedBoys = BoyObject << GetSelectedIndices;

                NBoys = N Items( SelectedBoys );

                If( NBoys > 1,

                                For( i = 1, i <= NBoys, i++,

                                                BoyObject << SetSelected( SelectedBoys, 0 )

                                )

                );

);

MyWindow = New Window( "Test Window",

                Panel Box( "Choice",

                                Text Box( "Select Boy(s)" ),

                                Lineup Box(

                                                BoyObject = List Box(

                                                                BoyList,

                                                                BoyScript;

                                                                Show( SelectedBoys );

                                                )

                                )

                ),

                Button Box( "Stop",

                                MyWindow << CloseWindow;

                                Throw();

                )

);

               

The above may or may not be a sensible way to script this, but I need to understand what's causing the difference.  It looks to me as if the BoyScript expression is running recursively in JMP 9, but not in JMP 8 (which is the way I want it to run).  Am I right, and if so, how can I stop it?

Many thanks

2 REPLIES
ms

Super User

Joined:

Jun 23, 2011

I can confirm this. I get the strange behaviour in JMP 9 but not in JMP 8 (both for mac).

Just for fun, I replaced 0 with 1 in << SetSelected, i.e. BoyObject << SetSelected( SelectedBoys, 1 ). JMP 8 worked as anticipated  while JMP 9 crashed completely. I tried this several times and and the crash happened every time.

Another strange thing, if the for loop is reversed in JMP 9 (i.e. i = NBoys, i >= 1, i--) the unselect works but the output lists are empty when trying to select more than one item

Listbox() appears to be buggy in JMP 9.

David_Burnham

Super User

Joined:

Jul 13, 2011

List Box behaviour has changed from 8 to 9 I think, and also between minor versions of 9.  However, something useful that has appeared I think in 9.02 is a new message Clear Selection that you can send to the list box which avoids the hassle of having to iterate through the list items to reset selection status

Dave

-Dave