GraphBox 的數量可變。如何確定我將點擊發送到哪個 GB?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(
<<ADD image=""></ADD>The above gives me
3 graphboxes :white_heavy_check_mark:</img>with three correctly rendered images, :white_heavy_check_mark:</img>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.
<LINGO-LABS id="lingo-labs-797481" slang="en-US" mode="UPDATE"><LINGO-LABEL>自動化和腳本編寫</LINGO-LABEL></LINGO-LABS>回覆:GraphBox 的數量可變。如何確定我將點擊發送到哪個 GB?每當使用者點擊圖像時,mousetrap 就會收到呼叫命令
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(
<<ADD image=""></ADD>
回覆:GraphBox 的數量可變。如何確定我將點擊發送到哪個 GB?哈哈,我明白了
foreach({jpeg}, files in directory(jpegs),
img = new image(jpeg);
h = Eval(
Eval Expr(
graphbox(
<<ADD image=""></ADD>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
回覆:GraphBox 的數量可變。如何確定我將點擊發送到哪個 GB?是的,這在 JSL 中是一個相當大的問題。不幸的是,沒有文件說明哪些參數被評估 - 哪些參數只是被「轉移」。
海德評估其論點嗎?
我要求 JMP 支援人員提供評估/不評估其參數的函數的官方清單。不幸的是,沒有這樣的清單。
另一種方法: 在 JSL 編輯器中使用一些高級語法突出顯示 - 該函數是否評估它的參數?
我希望,它將在接下來的一些版本中實現...
實際上,JSL 中的許多(!!!)函數在使用它們之前不會評估它們的(某些)參數。
這個方法的威力非常大!
「剛轉」最突出的例子:
New column (.... Formula(<U>Expression gets just transferred</U>))
這同樣適用於老鼠陷阱。
如果您再想一想,JMP 非常友善,它不評估參數:)
您希望在使用者點擊圖像時更改狀態訊息,而不是在執行程式碼時更改狀態訊息。
另一方面:要將圖像添加到窗口,JMP 必須打開圖像檔案 - 為此:查看變數。
注意:有時,用 Eval(argument) 替換參數會有所幫助。
有時。
這裡:沒有。