- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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"))
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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"))
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Modal windows - using {Button(1)} in if statements?
Thanks for the great support in short time MS,
It worked right a way.
/Daniel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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)};