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
nkelleh
Level III

How to stop users from resizing windows in JSL?

This might seem like a very simple question, but I was wondering, is there a way to stop users from re-sizing windows/dialogs using JSL?

There is a message you can send to a display box for auto stretching, min and max size, etc. Is there any flag for turning off the user capability to resize windows by default (i.e. mouse cursor doesn't show the resize arrows when hovering on the edge of a window? Seems like there should be something, but can't seem to find it.

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
msharp
Super User (Alumni)

Re: How to stop users from resizing windows in JSL?

If that is the purpose, is there any reason you can't put all the content into one window?  Using the H Splitter Box/V Splitter Box is probably your best solution.  The following example both keeps all display boxes visible in the window and prevents grey space when resizing the window.  From the Scripting Index:

Names Default To Here( 1 );

New Window( "Splitter",

       V Splitter Box(

              Size( 800, 600 ),

              H Splitter Box( graph = Graph Box(), Script Box(), <<Sizes( {0.6, 0.4} ) ),

              H Splitter Box(

                     pict = Picture Box( Open( "$SAMPLE_IMAGES/tile.jpg", jpg ) ),

                     spacer = Spacer Box(),

                     <<Sizes( {0.4, 0.6} )

              )

       )

);

graph[FrameBox( 1 )] << Set Auto Stretching( 1, 1 );

pict << Set Min Size( 100, 100 );

pict << Set Max Size( 500, 500 );

pict << Set Auto Stretching( 1, 1 );

spacer << Set Fill( 1 );

spacer << Color( "Red" );

spacer << Set Auto Stretching( 1, 1 );


This will be a better solution.  You'll really end up annoying your end user if you don't let them re-size windows.

View solution in original post

7 REPLIES 7
msharp
Super User (Alumni)

Re: How to stop users from resizing windows in JSL?

The functions you describe are all for re-sizing display boxes within windows.  But it sounds like you want to stop the window itself from being changed.  I have no idea why you would want to do this, but this would be a problem an operating system power user might be able to answer.  This isn't a functionality you are going to get in a scripting language.  You'd need to make changes to Windows 7,8,10 or in Mac: Snow Leopard, Capitan ect.

Anyways, you could cheat though.  Maybe something like this:

nw = new window("No Resize for You"); //Create example window

size = nw << Get Window Size; // Get size

//Resize function

resize = function({},

       nw << Set Window Size(size[1],size[2]); //Resize window

       schedule(0.1, resize()); //Resize window every 0.1 seconds

);

//call function

resize();

//hide scheduler window to complete illusion

wait(0);

window("Scheduler")<<Show Window(0);

//alternatively to << Set Window Size:

//nw << Zoom Window;

nkelleh
Level III

Re: How to stop users from resizing windows in JSL?

Hi msharp,

Thanks for the response. That method looks like it would work all right, and there are probably a few other ways to 'cheat' this behavior.

My reasoning for wanting this is that I'm creating a custom application that has dialog windows both for user input and reporting. I don't want the user to be able to click and resize the window so that the window either ends up hiding some of the display boxes within the window, or drag it wider and end up with a load of ugly grey space. I'll admit, this is for purely aesthetic reasons, but just thought it would be a useful option to have for people writing applications in JSL for distribution.

Cheers again.

msharp
Super User (Alumni)

Re: How to stop users from resizing windows in JSL?

If that is the purpose, is there any reason you can't put all the content into one window?  Using the H Splitter Box/V Splitter Box is probably your best solution.  The following example both keeps all display boxes visible in the window and prevents grey space when resizing the window.  From the Scripting Index:

Names Default To Here( 1 );

New Window( "Splitter",

       V Splitter Box(

              Size( 800, 600 ),

              H Splitter Box( graph = Graph Box(), Script Box(), <<Sizes( {0.6, 0.4} ) ),

              H Splitter Box(

                     pict = Picture Box( Open( "$SAMPLE_IMAGES/tile.jpg", jpg ) ),

                     spacer = Spacer Box(),

                     <<Sizes( {0.4, 0.6} )

              )

       )

);

graph[FrameBox( 1 )] << Set Auto Stretching( 1, 1 );

pict << Set Min Size( 100, 100 );

pict << Set Max Size( 500, 500 );

pict << Set Auto Stretching( 1, 1 );

spacer << Set Fill( 1 );

spacer << Color( "Red" );

spacer << Set Auto Stretching( 1, 1 );


This will be a better solution.  You'll really end up annoying your end user if you don't let them re-size windows.

nkelleh
Level III

Re: How to stop users from resizing windows in JSL?

Thanks again msharp,

For report dialogs I've no problem with the user being able to resize the window, it was for dialogs where I was asking for user input. These have fixed number of fields where they can input information and in my opinion should have no need to resize, but its purely for aesthetics and not a major issue in the grand scheme of things. It's just that in other programming languages where you have GUI widgets, you have the option of preventing the user from re-sizing dialogs, such as warning dialogs and the like, as re-sizing serves no real purpose. Just thought it would be useful option to have.

In any case, thanks for your example of a H/V Splitter Box, it's something I'll definitely make use of in the future. Cheers.

msharp
Super User (Alumni)

Re: How to stop users from resizing windows in JSL?

Key word "programming language", where again jsl is a scripting language.

David_Burnham
Super User (Alumni)

Re: How to stop users from resizing windows in JSL?

It's difficult to get around the resizing issue from a programming perspective because resizing of display boxes is inherent to the the JMP user interface.  On balance I think it's really useful e.g. stretching a list box when you have a large number of items, or items with long names.  But it can make life hard when you are trying to design an aesthetically pleasing interface.  Splitter boxes can help, although they also tend to encourage the users to resize the split components!  If you want to have a single window containing both user dialog and output elements then I think you need to think about the level of interaction. I often have this type of configuration where the dialog is for relatively infrequent interactions.  My preferred approach is to have a button on the window which acts as a toggle to turn the dialog on or off:

10404_capture3.JPG

(report window with no dialog - the left centre button 'options' will toggle the dialog on)

10405_capture4.JPG

(report window with dialog turned on)


At the most basic level this consists of two pieces of content aligned with an H List Box.


To close the dialog either the content size can be set to zero or the content can be deleted (the dialog values can be cached in a namespace for easy reloading).


A simpler solution is to use an Outline Box horizontally aligned with your content:


dt = Open("$SAMPLE_DATA/Big Class.jmp");

dialog = V List Box(

       Outline Box("Demo Dialog",

            << Outline Close Orientation("Vertical"),

            Lineup Box(NCol(2),Spacing(10),

                  Text Box("Label 1"),

                  Text Edit Box("value 1"),

                  Text Box("Label 2"),

                  Text Edit Box("value 2"),

      )

   )

);

content = V List Box(

    Bivariate( Y( :weight ), X( :height ) )

);

New Window("Report With Dialog",

    H List Box(

    dialog,

        Spacer Box(Size(10,0)),

    content

    )

);


10406_dialog1.JPG

The message Outline Close Orientation allows the content to collapse to the side of the window:

10407_dialog3.JPG

- Just some ideas.

Dave

-Dave
msharp
Super User (Alumni)

Re: How to stop users from resizing windows in JSL?

Great suggestions Dave!  I really like your design, and will look at doing things similar.  I typically use the outline box solution you gave at the end which is simple and easy to implement, but not always the most professional looking design.  I believe it really comes down to who the end user is.  For most my scripts that's really just me.

Concerning: "To close the dialog either the content size can be set to zero or the content can be deleted (the dialog values can be cached in a namespace for easy reloading)."
I believe an 'If box()' would be a simpler solution.