cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

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