cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
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)};