BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
LaserRasin
Occasional Contributor

Prevent window scrolling when adding display boxes

Is there a way to prevent a window from scrolling to the location of added boxes?  In the following example script, pressing the "Add Spline" button will add a new spline with half the lambda value from the one before, and after pressing the button 6 or so times, the window scrolls away from the graph to the location of the newly added control spline.

 

This is an example -- the solution IS NOT to simply remove the other control charts from the display.  In my actual code, I remove the control chart with the biv << (Curve[1] << Report( 0 )) command, but it scrolls nonetheless.

 

Any help would be greatly appreciated.

 

Thanks!

 

Names Default To Here( 1 );
n = 100;
New Window( "test",
    V List Box(
        b = Button Box( "Add Spline",
            n = n / 2;
            obj << Fit Spline( n, Standardized );
        ),
        dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
        obj = Bivariate( Y( :Weight ), X( :Height ) );
        obj << Fit Spline( n, Standardized );
    )
);
0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
gzmorgan0
Super User

Re: Prevent window scrolling when adding display boxes

Have you considered using a tabbed report with a selector?  See the picture below.  Or are you creating a page with multiple graphs, for example, side-by-side, for each view.   

 

Also,  other alternatives are:

  1. Create your Bivariate with two splines with collapsed (hidden) boxes. Until the user selects a value or the button, set the 2nd spline's line width to 0 so it would not be visible. Allow the user to select what the second spline's value should be. In other words, you are not adding a ton of splines, just send a message to change the smoothing factor of one. That would eliminate any jumping.
  2. Change the behavior of your Add Spline button to add a curve using Add Graphics Script, instead of using the UI messgae Fit Spline.  This would take extra scripting: using functions to get coefficients, evaluate, chose a color, add the graphics script,

Option #1 would be the easiest

The JMP UI slider anticipates what you are trying to emulate, the user can adjust the smoothing factor.

Figure10_7_fs.png

0 Kudos
6 REPLIES 6
gzmorgan0
Super User

Re: Prevent window scrolling when adding display boxes

From an interactive UI standpoint scrolling to to the fit summary makes sense.  This script employs two useful JMP display box functions/methods: Visibility() and Scroll Window(). Scroll Window() is used to always return to the top of the display, and visibility is used to "Collapse" the outline boxes associated with the splines.

 

Note, for simplicilty, this script uses the outline box count.  However, Xpath to find the kth Outline Box with helpKey starting with Bivar Spline, would be more direct.

 

Names Default To Here( 1 );
n = 100;
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
xp = Expr(report(obj)[OutlineBox(cnt)] <<Visibility("Collapse") );
New Window( "test",
 vlb =  V List Box(
        b = Button Box( "Add Spline",
            n = n / 2;
            obj << Fit Spline( n, Standardized );
            cnt++;
            xp;
            wait(0);
            vlb << scroll window(b);
        ),
        obj = dt <<  Bivariate( Y( :Weight ), X( :Height ) );
        obj << Fit Spline( n, Standardized );
        cnt = 2;
        xp;
    )
);

 

LaserRasin
Occasional Contributor

Re: Prevent window scrolling when adding display boxes

Thanks for your help!  However, my issue is that I don't want any part of the summary to be shown, I simply want the spline to be drawn.  To this end, I employ the Visibility( "Collapse" ) and (Curve[x] << Report(0)) commands, which successfully keeps the reports from showing.  However, the screen still moves as if they were shown.

 

I've included a more complete example here.  Clicking the button to add the spline immediately scrolls to the point where the graph is no longer visible, even though (in the end) no new content is displayed.

 

I have a report that is used in my company that has many graphs in a page like this example, and having the ability to interactively add splines is quite useful, but when the graph of interest moves off screen as a result, it makes it too much of an annoyance to deal with. 

 

Any help would be greatly appreciated!

 

Names Default To Here( 1 );
n = 100;
New Window( "test",
    V List Box(
        Outline Box( "a display",
            a1 = 1;
            V List Box(
                b = Button Box( "Add Spline",
                    n = n / 2;
                    a1++;
                    obj1 << Fit Spline( n, Standardized ) << (Curve[a1] << Report( 0 ));
                ),
                dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
                obj1 = Bivariate( Y( :Weight ), X( :Height ) );
                obj1 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
                (obj1 << Report())[List Box( 5 )] << Visibility( "Collapse" );
                (obj1 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
            );
        ),
        Outline Box( "a display",
            a2 = 1;
            V List Box(
                b = Button Box( "Add Spline",
                    n = n / 2;
                    a2++;
                    obj2 << Fit Spline( n, Standardized ) << (Curve[a2] << Report( 0 ));
                ),
                dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
                obj2 = Bivariate( Y( :Weight ), X( :Height ) );
                obj2 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
                (obj2 << Report())[List Box( 5 )] << Visibility( "Collapse" );
                (obj2 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
            );
        ),
        Outline Box( "a display",
            a3 = 1;
            V List Box(
                b = Button Box( "Add Spline",
                    n = n / 2;
                    a3++;
                    obj3 << Fit Spline( n, Standardized ) << (Curve[a3] << Report( 0 ));
                ),
                dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
                obj3 = Bivariate( Y( :Weight ), X( :Height ) );
                obj3 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
                (obj3 << Report())[List Box( 5 )] << Visibility( "Collapse" );
                (obj3 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
            );
        ),
        Outline Box( "a display",
            a4 = 1;
            V List Box(
                b = Button Box( "Add Spline",
                    n = n / 2;
                    a4++;
                    obj4 << Fit Spline( n, Standardized ) << (Curve[a4] << Report( 0 ));
                ),
                dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
                obj4 = Bivariate( Y( :Weight ), X( :Height ) );
                obj4 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
                (obj4 << Report())[List Box( 5 )] << Visibility( "Collapse" );
                (obj4 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
            );
        ),
        Outline Box( "a display",
            a5 = 1;
            V List Box(
                b = Button Box( "Add Spline",
                    n = n / 2;
                    a5++;
                    obj5 << Fit Spline( n, Standardized ) << (Curve[a5] << Report( 0 ));
                ),
                dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
                obj5 = Bivariate( Y( :Weight ), X( :Height ) );
                obj5 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
                (obj5 << Report())[List Box( 5 )] << Visibility( "Collapse" );
                (obj5 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
            );
        ),
        Outline Box( "a display",
            a6 = 1;
            V List Box(
                b = Button Box( "Add Spline",
                    n = n / 2;
                    a6++;
                    obj6 << Fit Spline( n, Standardized ) << (Curve[a6] << Report( 0 ));
                ),
                dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
                obj6 = Bivariate( Y( :Weight ), X( :Height ) );
                obj6 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
                (obj6 << Report())[List Box( 5 )] << Visibility( "Collapse" );
                (obj6 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
            );
        ),
        Outline Box( "a display",
            a7 = 1;
            V List Box(
                b = Button Box( "Add Spline",
                    n = n / 2;
                    a7++;
                    obj7 << Fit Spline( n, Standardized ) << (Curve[a7] << Report( 0 ));
                ),
                dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
                obj7 = Bivariate( Y( :Weight ), X( :Height ) );
                obj7 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
                (obj7 << Report())[List Box( 5 )] << Visibility( "Collapse" );
                (obj7 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
            );
        ),
        Outline Box( "a display",
            a8 = 1;
            V List Box(
                b = Button Box( "Add Spline",
                    n = n / 2;
                    a8++;
                    obj8 << Fit Spline( n, Standardized ) << (Curve[a8] << Report( 0 ));
                ),
                dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
                obj8 = Bivariate( Y( :Weight ), X( :Height ) );
                obj8 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
                (obj8 << Report())[List Box( 5 )] << Visibility( "Collapse" );
                (obj8 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
            );
        ),
        Outline Box( "a display",
            a9 = 1;
            V List Box(
                b = Button Box( "Add Spline",
                    n = n / 2;
                    a9++;
                    obj9 << Fit Spline( n, Standardized ) << (Curve[a9] << Report( 0 ));
                ),
                dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
                obj9 = Bivariate( Y( :Weight ), X( :Height ) );
                obj9 << Fit Spline( n, Standardized ) << (Curve[1] << Report( 0 ));
                (obj9 << Report())[List Box( 5 )] << Visibility( "Collapse" );
                (obj9 << Report())[Picture Box( 2 )] << Visibility( "Collapse" )
            );
        )
    )
);
0 Kudos
gzmorgan0
Super User

Re: Prevent window scrolling when adding display boxes

Which version of JMP are you using?

 

Attached are 2 scripts: scrollers_ob.jsl and scrollers.jsl

Both are essentially the same script, except for the scroll action.

scrollers_ob.jsl

  • uses just a VListBox(), vlb, and Scroll Window() to the outline box that contains the button the user just pressed. If a user scrolls to the 6th display, however, a portion of display 5 is showing it pops display 6 to the top. The user is is still seeing the graph of interest and the scroll action is smoooth.

scrollers0.jsl

  • uses a ScrollBox() wrapper, sb, for vlb.  A ScrollBox has a nice function << get scroll position. Using that function, to set the scroll position, the user will see the exact same position, however, the display is jumpy, not smooth.

 

Both scripts use expressions to eliminate "cookie cutter" code that can be dificult to read and to maintain. Note, it creates handles/references to each button box, each bivariate and each "display" outline box.  Right click on any button > select edit > select set script to see the reference to bivariate, etc.

 

As an FYI to to the JSL masters, I did try using Set Function() for the ButtonBox(), and using its parent and sibling. However,  I was surprised, vlb << Scroll Window(this) did not work for me.   It could have been a coding error. I didn't spend much time on it since I thought the code might be too obtuse to be informative.         

 

 

0 Kudos
LaserRasin
Occasional Contributor

Re: Prevent window scrolling when adding display boxes

Thanks for the help!  I will see if I can make this work, but I think that this method will in the end not work for me -- I am modifying a function that is called by various reports to generate the graphs -- I cannot add a scroll box to the reports.  The only solution that I can think of that would work for me is to simply prevent the new content from triggering the scroll mechanism.

0 Kudos
gzmorgan0
Super User

Re: Prevent window scrolling when adding display boxes

Have you considered using a tabbed report with a selector?  See the picture below.  Or are you creating a page with multiple graphs, for example, side-by-side, for each view.   

 

Also,  other alternatives are:

  1. Create your Bivariate with two splines with collapsed (hidden) boxes. Until the user selects a value or the button, set the 2nd spline's line width to 0 so it would not be visible. Allow the user to select what the second spline's value should be. In other words, you are not adding a ton of splines, just send a message to change the smoothing factor of one. That would eliminate any jumping.
  2. Change the behavior of your Add Spline button to add a curve using Add Graphics Script, instead of using the UI messgae Fit Spline.  This would take extra scripting: using functions to get coefficients, evaluate, chose a color, add the graphics script,

Option #1 would be the easiest

The JMP UI slider anticipates what you are trying to emulate, the user can adjust the smoothing factor.

Figure10_7_fs.png

0 Kudos
LaserRasin
Occasional Contributor

Re: Prevent window scrolling when adding display boxes

Option #2 of adding the spline by hand did the trick. JMP has a handy function to calculate splines, so this made it very easy.
0 Kudos