取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
选择语言 隐藏翻译栏
查看原发布的话题

GraphBoxes 的数量可变。如何识别我要将点击发送到哪个 GB?

mtowle419
Level II
nw = new window("graphs", vlb = v list box());
dirname = "jpegs";
set default directory(dirname);
foreach({jpeg}, files in directory(dirname), // dexter.jpg, samurai_jack.jpg, spongebob.jpg
	img = new image(jpeg);
	msg = eval insert("\!"^jpeg^\!""); 
	h = graphbox(
			<

The above gives me

  • 3 graphboxes
  • with three correctly rendered images,
  • but StatusMsg always sends "Spongebob.jpg". (Without the evalinsert(), just sending jpeg to StatusMsg, it throws an error.)

I want StatusMsg to give me the name of the image whose graphbox I clicked on.

Basically, I can kinda sorta imagine two routes:

1. Eval and related functions? I still haven't dug into that side of JSL very deeply.

2. Xpath? Maybe log the image name in a List; index will correspond with the frame box number.

这篇帖子最初是用 English (US) 书写的,已做计算机翻译处理。当您回复时,文字也会被翻译成 English (US)。

3 个已接受解答

已接受的解答
hogi
Level XII

回复:GraphBox 数量可变。如何识别我要将点击发送到哪个 GB?

每当用户点击图像时,捕鼠器就会收到调用的命令

statusmsg( variablename)

So: it will execute statusmsg( variablename), check for the current content of variablenamea and display it.

正如您注意到并尝试的那样:您必须以某种方式强制对变量进行评估。

问题:
将结果存储在另一个变量( msg )中会遇到同样的问题——只是另一个变量名。

您想要做什么:

对于每个图像预先评估图像名称和触发器,例如

statusmsg("samurai_jack.jpg")

在 90% 的情况下,这种预评估可以通过Eval(Eval Expr()) 完成。

对于其余的,使用Eval(Substitute())

JMP 中的表达式处理:Tipps 和 Trapdoors

Eval (Eval Expr( h=graphbox(
			<

mtowle419
Level II

回复:GraphBox 数量可变。如何识别我要将点击发送到哪个 GB?

哈哈,我明白了

foreach({jpeg}, files in directory(jpegs),
	img = new image(jpeg);

	h = Eval(
		Eval Expr(
			graphbox(
				<

It's not clear to me why `jpeg` needs the expr() and `img` doesn't, though. Both of those vars are 'born' on a per-loop basis

hogi
Level XII

回复:GraphBox 数量可变。如何识别要将点击发送到哪个 GB?

是的,这在 JSL 中是一个相当大的问题。不幸的是,没有文档说明哪些参数被求值 - 哪些参数只是被“传输”。有时很难找出答案:

Head 是否评价了它的论点?

我向 JMP 支持部门寻求了一份评估/不评估其参数的函数官方列表。不幸的是,没有这样的列表。
另一种方法: 在 JSL 编辑器中使用一些高级语法突出显示 - 该函数是否评估它的参数?

我希望它将在后续版本中实现....

实际上,JSL 中的许多(!!!)函数在使用它们之前并不会评估(部分)它们的参数。
这个办法非常的厉害!

最突出的“刚转学”例子:

New column (.... Formula(Expression gets just transferred))

对于 Mouse Trap 来说也是如此。
如果你再想一想 - JMP 非常好心地没有对参数进行求值:)
您希望在用户点击图像时更改状态消息 - 而不是在执行代码时。

另一方面:要将图像添加到窗口,JMP 必须打开图像文件 - 并且要这样做:查看变量。
注意:有时,用 Eval(argument) 替换参数会有所帮助。
有时。
这里:没有。

3 条回复3
hogi
Level XII

回复:GraphBox 数量可变。如何识别我要将点击发送到哪个 GB?

每当用户点击图像时,捕鼠器就会收到调用的命令

statusmsg( variablename)

So: it will execute statusmsg( variablename), check for the current content of variablenamea and display it.

正如您注意到并尝试的那样:您必须以某种方式强制对变量进行评估。

问题:
将结果存储在另一个变量( msg )中会遇到同样的问题——只是另一个变量名。

您想要做什么:

对于每个图像预先评估图像名称和触发器,例如

statusmsg("samurai_jack.jpg")

在 90% 的情况下,这种预评估可以通过Eval(Eval Expr()) 完成。

对于其余的,使用Eval(Substitute())

JMP 中的表达式处理:Tipps 和 Trapdoors

Eval (Eval Expr( h=graphbox(
			<

这篇帖子最初是用 English (US) 书写的,已做计算机翻译处理。当您回复时,文字也会被翻译成 English (US)。

mtowle419
Level II

回复:GraphBox 数量可变。如何识别我要将点击发送到哪个 GB?

哈哈,我明白了

foreach({jpeg}, files in directory(jpegs),
	img = new image(jpeg);

	h = Eval(
		Eval Expr(
			graphbox(
				<

It's not clear to me why `jpeg` needs the expr() and `img` doesn't, though. Both of those vars are 'born' on a per-loop basis

这篇帖子最初是用 English (US) 书写的,已做计算机翻译处理。当您回复时,文字也会被翻译成 English (US)。

hogi
Level XII

回复:GraphBox 数量可变。如何识别要将点击发送到哪个 GB?

是的,这在 JSL 中是一个相当大的问题。不幸的是,没有文档说明哪些参数被求值 - 哪些参数只是被“传输”。有时很难找出答案:

Head 是否评价了它的论点?

我向 JMP 支持部门寻求了一份评估/不评估其参数的函数官方列表。不幸的是,没有这样的列表。
另一种方法: 在 JSL 编辑器中使用一些高级语法突出显示 - 该函数是否评估它的参数?

我希望它将在后续版本中实现....

实际上,JSL 中的许多(!!!)函数在使用它们之前并不会评估(部分)它们的参数。
这个办法非常的厉害!

最突出的“刚转学”例子:

New column (.... Formula(Expression gets just transferred))

对于 Mouse Trap 来说也是如此。
如果你再想一想 - JMP 非常好心地没有对参数进行求值:)
您希望在用户点击图像时更改状态消息 - 而不是在执行代码时。

另一方面:要将图像添加到窗口,JMP 必须打开图像文件 - 并且要这样做:查看变量。
注意:有时,用 Eval(argument) 替换参数会有所帮助。
有时。
这里:没有。

这篇帖子最初是用 English (US) 书写的,已做计算机翻译处理。当您回复时,文字也会被翻译成 English (US)。