<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: JMP Slow Down after On Close with selection window in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JMP-Slow-Down-after-On-Close-with-selection-window/m-p/807755#M98714</link>
    <description>&lt;P&gt;Or other option outside of using modal window, is to move the actions you wish to perform to their own function/expression which will be executed when OK is pressed&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

expr_actions = Expr(
	group = rb &amp;lt;&amp;lt; Get Selected;
	show(group);	
);

groupsel = Expr(
	nwcurr = New Window("Select Group",
		V List Box(
			Text Box("Please select a group:"),
			rb = Radio Box({"A", "B", "C"}),
			Button Box("OK", 
				expr_actions;
				nwcurr &amp;lt;&amp;lt; Close Window;
			)
		)
	);
);

Eval(groupsel);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Modal is easier, but depending on the use case it will provide worse user-experience (at least in my opinion).&lt;/P&gt;</description>
    <pubDate>Wed, 23 Oct 2024 13:08:25 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-10-23T13:08:25Z</dc:date>
    <item>
      <title>JMP Slow Down after On Close with selection window</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Slow-Down-after-On-Close-with-selection-window/m-p/807658#M98702</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to prompt users to make a selection of groups from a window that opens at the start of a script that defines an object to be used for the remainder of the script. When the user selects and uses the button box, it works great, but if they close with the window, JMP slows down and&amp;nbsp; it becomes impossible to edit the script window without right clicking&amp;gt;Stop Script. Does anyone have any ideas on what is missing here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here (1);
groupsel=Expr(
done = 0;//Track if selection made
nwcurr = New Window("Select Group",
    V List Box(
        Text Box("Please select a group:"),
        rb = Radio Box({"A", "B", "C"}),
        Button Box("OK",
            // Set the selected currency based on the user's choice
            group = rb &amp;lt;&amp;lt; Get Selected;
            nwcurr &amp;lt;&amp;lt; Close Window;  // Close the modal window after selection
            done = 1;  // Mark the selection as done
        )
    )
);

nwcurr &amp;lt;&amp;lt; On Close(
        Throw("No selection made. Script stopped."),Stop();
    );
// Wait loop until the selection is made
Wait(0.1);  // Small wait to reduce CPU usage
while(done == 0, Wait(0.1));  // Loop until 'done' is set to 1
);

Eval(groupsel);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Oct 2024 07:45:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Slow-Down-after-On-Close-with-selection-window/m-p/807658#M98702</guid>
      <dc:creator>RahBarroso</dc:creator>
      <dc:date>2024-10-23T07:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Slow Down after On Close with selection window</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Slow-Down-after-On-Close-with-selection-window/m-p/807742#M98711</link>
      <description>&lt;P&gt;Your variable "done" will always be 0, if the window is just closed, so you'll be stuck in the While loop.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 11:58:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Slow-Down-after-On-Close-with-selection-window/m-p/807742#M98711</guid>
      <dc:creator>mmarchandFSLR</dc:creator>
      <dc:date>2024-10-23T11:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Slow Down after On Close with selection window</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Slow-Down-after-On-Close-with-selection-window/m-p/807749#M98712</link>
      <description>&lt;P&gt;This may be a good time to use a Modal window.&amp;nbsp; You won't need the "done" variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
groupsel = Expr(
	nwcurr = New Window( "Select Group",
		&amp;lt;&amp;lt;Modal,
		V List Box(
			Text Box( "Please select a group:" ),
			rb = Radio Box( {"A", "B", "C"} ),
			Button Box( "OK", 
            // Set the selected currency based on the user's choice
				group = rb &amp;lt;&amp;lt; Get Selected
			)
		)
	);
	If( nwcurr == {Button( -1 )},
		Throw( "No selection made." )
	);
);

Eval( groupsel );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Oct 2024 12:08:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Slow-Down-after-On-Close-with-selection-window/m-p/807749#M98712</guid>
      <dc:creator>mmarchandFSLR</dc:creator>
      <dc:date>2024-10-23T12:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Slow Down after On Close with selection window</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Slow-Down-after-On-Close-with-selection-window/m-p/807755#M98714</link>
      <description>&lt;P&gt;Or other option outside of using modal window, is to move the actions you wish to perform to their own function/expression which will be executed when OK is pressed&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

expr_actions = Expr(
	group = rb &amp;lt;&amp;lt; Get Selected;
	show(group);	
);

groupsel = Expr(
	nwcurr = New Window("Select Group",
		V List Box(
			Text Box("Please select a group:"),
			rb = Radio Box({"A", "B", "C"}),
			Button Box("OK", 
				expr_actions;
				nwcurr &amp;lt;&amp;lt; Close Window;
			)
		)
	);
);

Eval(groupsel);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Modal is easier, but depending on the use case it will provide worse user-experience (at least in my opinion).&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 13:08:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Slow-Down-after-On-Close-with-selection-window/m-p/807755#M98714</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-10-23T13:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Slow Down after On Close with selection window</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Slow-Down-after-On-Close-with-selection-window/m-p/807790#M98721</link>
      <description>&lt;P&gt;Use one of the previous suggestions. See &lt;LI-MESSAGE title="Modal Dialogs" uid="436177" url="https://community.jmp.com/t5/Uncharted/Modal-Dialogs/m-p/436177#U436177" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-blog-thread lia-fa-icon lia-fa-blog lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp; for examples that might help write a modal solution.&lt;/P&gt;
&lt;P&gt;Some of the behavior you are seeing is because of this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;nwcurr &amp;lt;&amp;lt; On Close(
        Throw("No selection made. Script stopped."),Stop();
    );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The OnClose expression needs to evaluate to 0 or 1; 0 (false) means the window should not be allowed to close and 1 (true) means allow the window to finish closing.&amp;nbsp; I'm not sure what happens with the throw, but probably not anything good; no value is returned. The stop() is never seen by JMP; it appears to be an extra unused parameter. Use a semicolon between statements.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 14:57:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Slow-Down-after-On-Close-with-selection-window/m-p/807790#M98721</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2024-10-23T14:57:16Z</dc:date>
    </item>
  </channel>
</rss>

