cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
DSA
DSA
Level III

Modal windows - using {Button(1)} in if statements?

Hi JMP community,

i am struggeling with a very simple issue but i cannot get it to work.

I have a modal window with some input fields, and OK/Cancel buttons.

I would like to do an if-statement based on the OK or Cancel button, so levering -1 vs 1 inside the Button( ) clause like they describes in Modal Windows.

So how do i actually constructed my if statement to use this?

I guess it is some sort of function handle and i cannot get it to work as a text string and i cannot manage to extract the -1 or 1.

What is the better practice here?

Thanks in advance,

Daniel

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Modal windows - using {Button(1)} in if statements?

// One way to use the default Modal Window output

Q = New Window("test", <<Modal, Button Box("OK"), Button Box("Cancel"));

If(Arg(Q[1], 1) == 1,

    Print("Okayed"),

    Print("Canceled")

);

// But it's easier to use a button script

New Window("test",

    <<Modal,

    Button Box("OK", Print("Okayed")),

    Button Box("Cancel", Print("Canceled"))

);

View solution in original post

3 REPLIES 3
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Modal windows - using {Button(1)} in if statements?

// One way to use the default Modal Window output

Q = New Window("test", <<Modal, Button Box("OK"), Button Box("Cancel"));

If(Arg(Q[1], 1) == 1,

    Print("Okayed"),

    Print("Canceled")

);

// But it's easier to use a button script

New Window("test",

    <<Modal,

    Button Box("OK", Print("Okayed")),

    Button Box("Cancel", Print("Canceled"))

);

DSA
DSA
Level III

Re: Modal windows - using {Button(1)} in if statements?

Thanks for the great support in short time MS,

It worked right a way.

/Daniel

msharp
Super User (Alumni)

Re: Modal windows - using {Button(1)} in if statements?

Alternatively, the result stored from a New Window object is an actual object, thus bracket notation can be used.  I should note this is practically the only object supported by JSL.

Q = New Window("test", <<Modal, Button Box("OK"), Button Box("Cancel"));

If(Q["Button"] == 1,

    Print("Okayed"),

    Print("Canceled")

);

//Q = {Button(-1)};

Recommended Articles