<?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: How to reference Outline Box from within red triangle menu without using variables in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-reference-Outline-Box-from-within-red-triangle-menu/m-p/825428#M100560</link>
    <description>&lt;P&gt;Hard to find more details - even for LLMs:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1735471803768.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71574i415CF7F8AF4E5855/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1735471803768.png" alt="hogi_0-1735471803768.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 29 Dec 2024 11:30:56 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2024-12-29T11:30:56Z</dc:date>
    <item>
      <title>How to reference Outline Box from within red triangle menu without using variables</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-reference-Outline-Box-from-within-red-triangle-menu/m-p/825339#M100540</link>
      <description>&lt;P&gt;Here's a reworked example from Scripting Index:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

	ob = Outline Box( "Picker",
		{"Copy picture", ob &amp;lt;&amp;lt; Copy Picture()},
		H List Box( Text Box( "Label:" ), teb = Text Edit Box( Char( 213 ) ) )
	);

New Window( "Example",
ob
);

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It adds a menu item in the red triangle menu that would copy the picture of this box to the buffer.&lt;/P&gt;&lt;P&gt;Script works just fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is: what if I create my Outline Boxes dynamically, and I don't have a variable assigned to it.&lt;/P&gt;&lt;P&gt;How do I reference this Outline Box without variable? Something using keywords "this" or "self".&lt;/P&gt;&lt;P&gt;Something like this on the second box:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
vb = V List Box(
	ob = Outline Box( "Picker",
		{"Copy picture", ob &amp;lt;&amp;lt; Copy Picture()},
		H List Box( Text Box( "Label:" ), teb = Text Edit Box( Char( 213 ) ) )
	),
Outline Box( "Picker",
		{"Copy picture", this &amp;lt;&amp;lt; Copy Picture()},
		H List Box( Text Box( "Label number 2:" ), teb = Text Edit Box( Char( 213 ) ) )
	);
);




New Window( "Example",
vb
);

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;There are good examples in Scripting Index for Set Function on number of Display Boxes:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
New Window( "Example",
	Button Box( "press me", &amp;lt;&amp;lt;setFunction( Function( {thisBox}, thisBox &amp;lt;&amp;lt; setButtonName( "thanks" ) ) ) )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But in this case we're not setting function, we're setting script, and this syntaxis doesn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, how do I accomplish this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2024 02:03:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-reference-Outline-Box-from-within-red-triangle-menu/m-p/825339#M100540</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2024-12-28T02:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference Outline Box from within red triangle menu without using variables</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-reference-Outline-Box-from-within-red-triangle-menu/m-p/825361#M100542</link>
      <description>&lt;P&gt;I don't think you have functionality like that for outline box menu scripts so you have to use something else. Three okeish options come to my mind:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Evaluate the reference&lt;/LI&gt;
&lt;LI&gt;Use Window scope&lt;/LI&gt;
&lt;LI&gt;Use Box scope&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

context_example = Context Box(
	box:ob1 = Outline Box("Picker",
		{"Copy picture1", box:ob1 &amp;lt;&amp;lt; Copy Picture()},
		H List Box(
			Text Box("Label:"), 
			teb = Text Edit Box(Char(213))
		)
	)
);

eval_example = Outline Box("Picker",
	H List Box(
		Text Box("Label:"), 
		teb = Text Edit Box(Char(612))
	)
);
Eval(EvalExpr(
	eval_example &amp;lt;&amp;lt; Set Menu Script(
		{"Copy Picture3", Expr(eval_example) &amp;lt;&amp;lt; Copy Picture()}
	);	
));

nw = New Window("Example", 
	context_example,
	window:ob1 = Outline Box("Picker",
		{"Copy picture2", window:ob1 &amp;lt;&amp;lt; Copy Picture()},
		H List Box(
			Text Box("Label:"), 
			teb = Text Edit Box(Char(451))
		)
	),
	eval_example
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Dec 2024 06:24:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-reference-Outline-Box-from-within-red-triangle-menu/m-p/825361#M100542</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-12-28T06:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference Outline Box from within red triangle menu without using variables</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-reference-Outline-Box-from-within-red-triangle-menu/m-p/825367#M100545</link>
      <description>&lt;P&gt;Looks like Eval and Context box ways are working in my case, Window - does not.&lt;/P&gt;&lt;P&gt;Here is what I used to check, it imitates dynamic creating of Outline Boxes:&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);
vb = V List Box();
context_example = Context Box(
	box:ob1 = Outline Box("Context1",
		{"Copy picture1", box:ob1 &amp;lt;&amp;lt; Copy Picture()},
		H List Box(
			Text Box("Label:"), 
			teb = Text Edit Box(Char(213))
		)
	)
);
vb &amp;lt;&amp;lt; Append (context_example);
context_example = Context Box(
	box:ob1 = Outline Box("Context2",
		{"Copy picture1", box:ob1 &amp;lt;&amp;lt; Copy Picture()},
		H List Box(
			Text Box("Label:"), 
			teb = Text Edit Box(Char(213))
		)
	)
);
vb &amp;lt;&amp;lt; Append (context_example);


eval_example = Outline Box("Eval1",
	H List Box(
		Text Box("Label:"), 
		teb = Text Edit Box(Char(612))
	)
);
Eval(EvalExpr(
	eval_example &amp;lt;&amp;lt; Set Menu Script(
		{"Copy Picture3", Expr(eval_example) &amp;lt;&amp;lt; Copy Picture()}
	);	
));
vb &amp;lt;&amp;lt; Append (eval_example);
eval_example = Outline Box("Eval2",
	H List Box(
		Text Box("Label:"), 
		teb = Text Edit Box(Char(612))
	)
);
Eval(EvalExpr(
	eval_example &amp;lt;&amp;lt; Set Menu Script(
		{"Copy Picture3", Expr(eval_example) &amp;lt;&amp;lt; Copy Picture()}
	);	
));
vb &amp;lt;&amp;lt; Append (eval_example);


nw = New Window("Example", 
	window:ob1 = Outline Box("Window1",
		{"Copy picture2", window:ob1 &amp;lt;&amp;lt; Copy Picture()},
		H List Box(
			Text Box("Label:"), 
			teb = Text Edit Box(Char(451))
		)
	),
	window:ob1 = Outline Box("Window2",
		{"Copy picture2", window:ob1 &amp;lt;&amp;lt; Copy Picture()},
		H List Box(
			Text Box("Label:"), 
			teb = Text Edit Box(Char(451))
		)
	),
	vb
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In case of Window in both cases of Window1 and Window2 it copies picture of Window2 box.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2024 06:57:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-reference-Outline-Box-from-within-red-triangle-menu/m-p/825367#M100545</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2024-12-28T06:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference Outline Box from within red triangle menu without using variables</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-reference-Outline-Box-from-within-red-triangle-menu/m-p/825392#M100548</link>
      <description>&lt;P&gt;You can use a variable multiple times in a script to assign different values. At the end, the variable will contain the last value. This holds for&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;x=5;
x=7;
show(x);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and for &lt;FONT face="courier new,courier"&gt;:ob1&lt;/FONT&gt;.&lt;BR /&gt;The solution&amp;nbsp; use 2 different variables to define references to 2 different objects:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;nw = New Window("Example", 
	window:ob1 = Outline Box("Window1",
		{"Copy picture", window:ob1 &amp;lt;&amp;lt; Copy Picture()},
		H List Box(
			Text Box("Label:"), 
			teb = Text Edit Box("#1")
		)
	),
	window:ob2 = Outline Box("Window2",
		{"Copy picture", window:ob2 &amp;lt;&amp;lt; Copy Picture()},
		H List Box(
			Text Box("Label:"), 
			teb = Text Edit Box("#2")
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2024 16:33:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-reference-Outline-Box-from-within-red-triangle-menu/m-p/825392#M100548</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-12-28T16:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference Outline Box from within red triangle menu without using variables</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-reference-Outline-Box-from-within-red-triangle-menu/m-p/825425#M100558</link>
      <description>&lt;P&gt;You are overwriting your references in your window example (use window:ob1 and window:ob2 for example). This doesn't happen within context box as box: seems to remember in which context box it belongs to. Depending on your "real" use case and application, the evaluation method is usually the most robust but all of these have their pros and cons (as does just using direct references). &lt;/P&gt;</description>
      <pubDate>Sun, 29 Dec 2024 07:39:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-reference-Outline-Box-from-within-red-triangle-menu/m-p/825425#M100558</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-12-29T07:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference Outline Box from within red triangle menu without using variables</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-reference-Outline-Box-from-within-red-triangle-menu/m-p/825428#M100560</link>
      <description>&lt;P&gt;Hard to find more details - even for LLMs:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1735471803768.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/71574i415CF7F8AF4E5855/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1735471803768.png" alt="hogi_0-1735471803768.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Dec 2024 11:30:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-reference-Outline-Box-from-within-red-triangle-menu/m-p/825428#M100560</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-12-29T11:30:56Z</dc:date>
    </item>
  </channel>
</rss>

