更改腳本上的數字編輯框我是 JSL 和 Application Builder 的新手,所以請耐心等待。
我正在嘗試構建一個具有一系列配對數字編輯框的對話框。每對中的一個代表“開始”時間,另一個代表相應的“結束”時間:
我想避免用戶輸入“開始”時間晚於“結束”時間或“結束”時間早於“開始”時間的情況。
我的第一個想法是為每個框添加一個“on change”腳本,類似於“start”框:
If( (Start << Get) > (End << Get),
End << Set( Start << Get )
);
對於“結束”框,就像這樣:
If( Start << Get > End << Get,
Start << Set( End << Get )
);
但這不起作用(從某種意義上說,當不需要的情況發生時什麼都不會發生)。
我可能正在做一些非常愚蠢的事情,但我們將不勝感激。
回复:更改腳本上的數字編輯框謝謝大家的幫助!!!
回复:更改腳本上的數字編輯框應用程序生成器需要一些時間來學習,但這是值得的。我從 JMP 版本 10 開始就一直在使用它,並且每個版本都變得更好。我附上了我在 JMP Discovery 2013 JSL 圓桌會議上所做的演示文稿,這可能會有所幫助。
回复:更改腳本上的數字編輯框是的,您可以在文本編輯器中打開保存的應用程序構建器文件,但應用程序構建器 gui 是編輯文件的唯一受支持方式。 (如果您想了解打開腳本時會發生什麼,仍然值得一看。)
這是網絡上的一些資源鏈接。
https://community.jmp.com/t5/Discovery-Summit-2016/Building-Dashboards-and-Applications-Poster-and-Tutorial/ta-p/22374
回复:更改腳本上的數字編輯框謝謝大家的好建議。 我還沒有全部嘗試過,但是一旦我從“真正的”工作中休息一下,我就會嘗試。
同時,我認為很多問題的根源在於我沒有找到 App Builder (AB) 的詳細文檔。 它必須存在,但我找不到它。 有人有鏈接嗎?
例如,我不知道 AB 的 Properties 菜單中的“Script”字段是做什麼用的,也沒有與 Number Edit Box (NEB) 文檔建立聯繫。 很明顯,我在這裡摸索著。
我困惑的另一個例子是 NEB 的 AB 屬性窗格中的“增量”輸入字段存在,但不接受輸入。 我可以繼續……
就像我說的,一些關於 AB 的好文檔,以及一些複雜模式對話框腳本的優秀示例會很棒。另外,有沒有辦法實際查看 AB 為接口生成的代碼?
回复:更改腳本上的數字編輯框這是示例。使用 JMP 13 創建,因此在早期版本中可能無法使用。
回复:更改腳本上的數字編輯框您需要設置腳本來調用每個數字編輯框。我創建了一個簡單的示例:
start_time_neb :開始時間的數字編輯框
end_time_neb : 結束時間的數字編輯框
我右鍵單擊每個數字編輯框並選擇腳本 > 腳本(未更改編號)。這是我添加的腳本:
// This function is called when the number edit value is committed
start_time_nebScript=Function({this},{start_time_value, end_time_value},
start_time_value = this << Get;
end_time_value = end_time_neb << get;
if (!is missing(start_time_value) & !is missing(end_time_value),
if (start_time_value > end_time_value,
nw = new window("Error", << modal(),
text box("The Start Time cannot be after the End Time")
);
this << set(.);
);
);
);
// This function is called when the number edit value is committed
end_time_nebScript=Function({this},{start_time_value, end_time_value},
start_time_value = start_time_neb << get;
end_time_value = this << Get;
if (!is missing(start_time_value) & !is missing(end_time_value),
if (start_time_value > end_time_value,
nw = new window("Error", << modal(),
text box("The End Time cannot be before the Start Time")
);
this << set(.);
);
);
);
回复:更改腳本上的數字編輯框有幾件事可以嘗試:
1. 查看日誌窗口 - 雖然似乎沒有發生任何事情,但可能會報告一個錯誤,這將為您提供線索
2. 將代碼簡化為盡可能簡單的東西。這將幫助您弄清楚哪些有效,哪些無效。例如,這似乎按照您描述的方式工作:
New Window("Test",
neb1 = NumberEditBox(0),
neb2 = NumberEditBox(0)
);
neb1 << Set Function(
If( (neb1 << Get) > (neb2 << Get),
neb2 << Set( neb1 << Get )
)
);
neb2 << Set Function(
If( (neb1 << Get) > (neb2 << Get),
neb1 << Set( neb2 << Get )
)
);
回复:更改腳本上的數字編輯框您可以通過在 SetFunction(而不是 OnChange)中設置開始和結束 NumberEditBoxes 的最小值/最大值來執行此操作。
New Window( "Example",
Lineup Box( N Col( 2 ),
Text Box( "Work Starts" ),
Text Box( "Work Ends" ),
start_neb = Number Edit Box(
0,
<<SET format=""></SET>