<?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: Trouble Closing Button Box window after button was already pressed in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Trouble-Closing-Button-Box-window-after-button-was-already/m-p/212863#M42603</link>
    <description>Thank you!</description>
    <pubDate>Thu, 13 Jun 2019 01:47:39 GMT</pubDate>
    <dc:creator>nguyendv0610</dc:creator>
    <dc:date>2019-06-13T01:47:39Z</dc:date>
    <item>
      <title>Trouble Closing Button Box window after button was already pressed</title>
      <link>https://community.jmp.com/t5/Discussions/Trouble-Closing-Button-Box-window-after-button-was-already/m-p/212781#M42598</link>
      <description>&lt;P&gt;My launchWin window consist of interactive button boxes. However when I press the button, the window will not close. Im not sure why. I thought the button is supposed to close automatically after being clicked on&lt;/P&gt;&lt;P&gt;I have the below Code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;//Set the working table as the current table, pay attention to which table is at the top&lt;BR /&gt;dt = currentdatatable();&lt;/P&gt;&lt;P&gt;//Create a summary of the total aliquots in each box by BOX ID&lt;BR /&gt;sumdt = dt &amp;lt;&amp;lt; Summary(&lt;BR /&gt;Group( :BOX ID ),&lt;BR /&gt;Sum( :Name( "# of aliquots" ) ),&lt;BR /&gt;Freq( "None" ),&lt;BR /&gt;Weight( "None" )&lt;BR /&gt;);&lt;BR /&gt;//Calculate Free Space in each box and assign to new col&lt;BR /&gt;col5 = sumdt &amp;lt;&amp;lt; New Column("FreeSpace", Data Type (Numeric),&lt;BR /&gt;Formula(&lt;BR /&gt;96 - :Name("Sum(# of aliquots)")&lt;BR /&gt;&lt;BR /&gt;)&lt;BR /&gt;);&lt;BR /&gt;//sort new table by new col&lt;BR /&gt;sumdt &amp;lt;&amp;lt; Sort(By(:FreeSpace), Order(Descending), Replace Table);&lt;/P&gt;&lt;P&gt;box10 = sumdt[index(1,10), 1];&lt;BR /&gt;row10 = sumdt[index(1,10), 4];&lt;BR /&gt;close(sumdt, nosave);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;launchWin = New Window( "Launcher",&lt;BR /&gt;&amp;lt;&amp;lt;Modal,&lt;BR /&gt;V List Box(&lt;BR /&gt;&lt;BR /&gt;Lineup Box( N Col( 4 ), Spacing( 20 ),&lt;BR /&gt;&lt;BR /&gt;//Check for Free space&lt;BR /&gt;Button Box( "Check Space",&lt;BR /&gt;New Window ("Available Spaces",&lt;BR /&gt;Table Box(&lt;BR /&gt;Number Col Box("Box ID", box10),&lt;BR /&gt;Number Col Box("Available Slot", row10)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;),&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//Cancel&lt;BR /&gt;Button Box( "Cancel", Throw( 1 ) )&lt;BR /&gt;),&lt;BR /&gt;)&lt;BR /&gt;);&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 17:05:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Trouble-Closing-Button-Box-window-after-button-was-already/m-p/212781#M42598</guid>
      <dc:creator>nguyendv0610</dc:creator>
      <dc:date>2019-06-12T17:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Closing Button Box window after button was already pressed</title>
      <link>https://community.jmp.com/t5/Discussions/Trouble-Closing-Button-Box-window-after-button-was-already/m-p/212814#M42600</link>
      <description>&lt;P&gt;If the Button Box were named "OK", it would close automatically. But you've created your own button with its own name, which is perfectly fine, but the custom button will only do what you tell it to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's two ways to add the ability to close a button's window. One is to assign the Button Box to a variable, and then send it the Close Window message within the button's script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;b=Button Box( "Check Space",
	New Window( "Available Spaces",
		Table Box( Number Col Box( "Box ID", box10 ), Number Col Box( "Available Slot", row10 ) )
	);
	b&amp;lt;&amp;lt;Close Window;
)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you can assign a function to the button and avoid adding a variable to the global namespace:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Button Box( "Check Space",
	&amp;lt;&amp;lt;Set Function( Function( {this},
		New Window( "Available Spaces",
			Table Box( Number Col Box( "Box ID", box10 ), Number Col Box( "Available Slot", row10 ) )
		);
		this&amp;lt;&amp;lt;Close Window
	))
)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Melanie&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 20:50:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Trouble-Closing-Button-Box-window-after-button-was-already/m-p/212814#M42600</guid>
      <dc:creator>Melanie_J_Drake</dc:creator>
      <dc:date>2019-06-12T20:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Closing Button Box window after button was already pressed</title>
      <link>https://community.jmp.com/t5/Discussions/Trouble-Closing-Button-Box-window-after-button-was-already/m-p/212863#M42603</link>
      <description>Thank you!</description>
      <pubDate>Thu, 13 Jun 2019 01:47:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Trouble-Closing-Button-Box-window-after-button-was-already/m-p/212863#M42603</guid>
      <dc:creator>nguyendv0610</dc:creator>
      <dc:date>2019-06-13T01:47:39Z</dc:date>
    </item>
  </channel>
</rss>

