<?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 Stop Code When Cancel Button Pressed in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Stop-Code-When-Cancel-Button-Pressed/m-p/518500#M74454</link>
    <description>&lt;P&gt;I have some code that allows users to pick several options. If they press OK then the code runs as expected but I can't get the cancel button to cancel the code. Exiting the window also results in the code being run. I would like the user to be able to cancel or exit the window and have that stop the code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;win = New Window( "Customise Analysis",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;Return Result,
	&amp;lt;&amp;lt;On Validate(x = cb&amp;lt;&amp;lt;Get();
		If( ...
		);
	),
	Text Box("Choose the product"),
	cb = Combo Box(
		{"..."},
	),
	Text Box( "..." ),
	fail_out = Number Edit Box( 100 ),
	Text Box("..."),
	Text Box("..."),
	point_lim = Number Edit Box(2),
	Button Box("OK"),
	Button Box("Cancel"),
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 17:03:37 GMT</pubDate>
    <dc:creator>Jemster</dc:creator>
    <dc:date>2023-06-09T17:03:37Z</dc:date>
    <item>
      <title>Stop Code When Cancel Button Pressed</title>
      <link>https://community.jmp.com/t5/Discussions/Stop-Code-When-Cancel-Button-Pressed/m-p/518500#M74454</link>
      <description>&lt;P&gt;I have some code that allows users to pick several options. If they press OK then the code runs as expected but I can't get the cancel button to cancel the code. Exiting the window also results in the code being run. I would like the user to be able to cancel or exit the window and have that stop the code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;win = New Window( "Customise Analysis",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;Return Result,
	&amp;lt;&amp;lt;On Validate(x = cb&amp;lt;&amp;lt;Get();
		If( ...
		);
	),
	Text Box("Choose the product"),
	cb = Combo Box(
		{"..."},
	),
	Text Box( "..." ),
	fail_out = Number Edit Box( 100 ),
	Text Box("..."),
	Text Box("..."),
	point_lim = Number Edit Box(2),
	Button Box("OK"),
	Button Box("Cancel"),
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:03:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stop-Code-When-Cancel-Button-Pressed/m-p/518500#M74454</guid>
      <dc:creator>Jemster</dc:creator>
      <dc:date>2023-06-09T17:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: Stop Code When Cancel Button Pressed</title>
      <link>https://community.jmp.com/t5/Discussions/Stop-Code-When-Cancel-Button-Pressed/m-p/518503#M74455</link>
      <description>&lt;P&gt;One option would be to use the button value returned from the window:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
nw = New Window("Dialog() example",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;Return Result,
	V List Box(
		H List Box("Set this value", variable = Number Edit Box(42)),
		H List Box(Button Box("OK"), Button Box("Cancel"))
	)
);

If(nw["Button"] != 1,
	stop();
);
show("continue");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jul 2022 09:26:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Stop-Code-When-Cancel-Button-Pressed/m-p/518503#M74455</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-07-07T09:26:54Z</dc:date>
    </item>
  </channel>
</rss>

