cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
AlterEgo
Level III

Self-reference in the hot-spot script ("Set Menu Script"). Is it possible?

Hi,

 

is self-reference possible in the hot-spot commands ("<< Set Menu Script"), similar to "<<Set Function".

E.g., in the example below I'd like to have a hot-spot commands instead of the buttons:

 

Names Default To Here( 1 );

names = {"AAAA", "BBBB", "CCCC", "DDDD"};

New Window( "Example",
	For( i = 1, i <= N Items( names ), i++,
		<<append(
			Outline Box( names[i], Button Box( "Show my name", <<Set Function( Function( {self}, Show( (self << parent) << get title ) ) ) ), )
		)
	)
);

 What I'd like to have is something like below:

 

New Window( "Example",
	For( i = 1, i <= N Items( names ), i++,
		<<append(
			Outline Box( names[i],
				<<Set Menu Script(
					{ "Show my name", <function with reference to self here> },
				)
			)
		)
	)
);

Assigning each outline box to variable is not an option. I need to be able to do it dynamically. Any ideas?

 

 

Thanks

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: Self-reference in the hot-spot script ("Set Menu Script"). Is it possible?

Not sure if there is anything like << set function for outline boxes and their context menu, but you can use Eval(EvalExpr()) (or other methods, Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute ) for quite similar effect

Names Default To Here(1);

names = {"AAAA", "BBBB", "CCCC", "DDDD"};
vlb = V List Box();

For Each({name}, names,
	vlb << append(ob = Outline Box(name));
	Eval(EvalExpr(ob << Set Menu Script(
		{"Show my name", Show(Expr(ob) << get title)}
	)));
);

nw = New Window( "Example", vlb);

(nw << XPath("//OutlineBox")) << Get Menu Script;
-Jarmo

View solution in original post

AlterEgo
Level III

Re: Self-reference in the hot-spot script ("Set Menu Script"). Is it possible?

Thanks! Excellent, just what I need.

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Self-reference in the hot-spot script ("Set Menu Script"). Is it possible?

Not sure if there is anything like << set function for outline boxes and their context menu, but you can use Eval(EvalExpr()) (or other methods, Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute ) for quite similar effect

Names Default To Here(1);

names = {"AAAA", "BBBB", "CCCC", "DDDD"};
vlb = V List Box();

For Each({name}, names,
	vlb << append(ob = Outline Box(name));
	Eval(EvalExpr(ob << Set Menu Script(
		{"Show my name", Show(Expr(ob) << get title)}
	)));
);

nw = New Window( "Example", vlb);

(nw << XPath("//OutlineBox")) << Get Menu Script;
-Jarmo
AlterEgo
Level III

Re: Self-reference in the hot-spot script ("Set Menu Script"). Is it possible?

Thanks! Excellent, just what I need.

Recommended Articles