<?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: Buttons to close modal dialog in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Buttons-to-close-modal-dialog/m-p/827884#M100964</link>
    <description>&lt;P&gt;You can make that button press OK button using &amp;lt;&amp;lt; Click(1)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
a = 0;
nw = New Window("Demo",
	&amp;lt;&amp;lt;modal,
	&amp;lt;&amp;lt;returnresult,
	Text Box("A modal dialog"),
	Button Box("Do something different",
		a = 1;
		ok_btn &amp;lt;&amp;lt; Click(1);
	), // I want this to close the dialog!
	H List Box(ok_btn = Button Box("OK"), Button Box("Cancel"))
);
Show(nw, a);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 17 Jan 2025 11:44:53 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2025-01-17T11:44:53Z</dc:date>
    <item>
      <title>Buttons to close modal dialog</title>
      <link>https://community.jmp.com/t5/Discussions/Buttons-to-close-modal-dialog/m-p/827874#M100963</link>
      <description>&lt;P&gt;As I understand it, only a maximum of two buttons can close a modal dialog: "OK" and "Cancel" (or other similarly named buttons).&lt;/P&gt;&lt;P&gt;What I'd like is to have another button which does something (say, set a variable), then closes the dialog as if I'd pressed the "OK" button. Something like this:&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 );
a=0;
nw = New Window( "Demo",
	&amp;lt;&amp;lt;modal,
	&amp;lt;&amp;lt;returnresult,
	Text Box( "A modal dialog" ),
	Button Box( "Do something different", a = 1 ), // I want this to close the dialog!
	H List Box( Button Box( "OK" ), Button Box( "Cancel" ) )
);
Show( nw, a );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is there any way of doing this? I tried including "nw &amp;lt;&amp;lt; close window" in the button script but that didn't work.&lt;/P&gt;&lt;P&gt;I could use a text edit box, or a check box, or many other options to set a=1 before pressing "OK", but all of those are additional clicks.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 11:23:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Buttons-to-close-modal-dialog/m-p/827874#M100963</guid>
      <dc:creator>matth1</dc:creator>
      <dc:date>2025-01-17T11:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Buttons to close modal dialog</title>
      <link>https://community.jmp.com/t5/Discussions/Buttons-to-close-modal-dialog/m-p/827884#M100964</link>
      <description>&lt;P&gt;You can make that button press OK button using &amp;lt;&amp;lt; Click(1)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
a = 0;
nw = New Window("Demo",
	&amp;lt;&amp;lt;modal,
	&amp;lt;&amp;lt;returnresult,
	Text Box("A modal dialog"),
	Button Box("Do something different",
		a = 1;
		ok_btn &amp;lt;&amp;lt; Click(1);
	), // I want this to close the dialog!
	H List Box(ok_btn = Button Box("OK"), Button Box("Cancel"))
);
Show(nw, a);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Jan 2025 11:44:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Buttons-to-close-modal-dialog/m-p/827884#M100964</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-01-17T11:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Buttons to close modal dialog</title>
      <link>https://community.jmp.com/t5/Discussions/Buttons-to-close-modal-dialog/m-p/827885#M100965</link>
      <description>&lt;P&gt;Thank you, nice solution! I was unaware that Click() existed - one to remember.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 11:55:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Buttons-to-close-modal-dialog/m-p/827885#M100965</guid>
      <dc:creator>matth1</dc:creator>
      <dc:date>2025-01-17T11:55:11Z</dc:date>
    </item>
  </channel>
</rss>

