如何顯示要求使用者輸入的文字方塊?你好,
我正在嘗試創建一個分析我的數據的基本腳本。
當我按下連結到腳本的縮圖時,我希望它
1. 要求使用者輸入範圍
2. 建立一個顯示最大值和最小值的資料表
3. 產生一個圖表,其中包含最小值、最大值和目標。
到目前為止,我所能做的就是獲取資料表或圖形的腳本,並將其單獨合併到 JMP 中的快捷方式中。 我不知道如何讓它為用戶生成查詢框,並且我無法將圖形和資料表合併在一起。 您能否建議一個可能對此有所幫助的基本教程集?
親切的問候,
埃萊娜
回覆:如何顯示一個文字框,要求使用者輸入。嗨,賈莫,
再次感謝! 還有一個問題:為什麼我的腳本在使用 userFirstName 和 userLastName 時可以工作,但在定義檔路徑字串文字中使用 b1,b2 時卻不起作用:
// Defining firstname and lastname string
userFirstName = "XXXX";
userLastName = "YYYY";
//changing username variables based on user input
w = New Window( "Defining User Name", <<MODAL></MODAL>
最好的,
晚的
回覆:如何顯示一個文字框,要求使用者輸入。您收到此錯誤是因為您正在使用模態視窗並且“太早”關閉它。 模態窗口是特殊類型的窗口,基本上要求您使用特定的按鈕標題腳本編寫指南 > 顯示樹 > JSL 中的模態視窗 > 建構模態視窗
筆記:模態視窗至少需要一個按鈕來關閉視窗。 您可以使用好的,是的,不, 或者取消為模態視窗按鈕新增標籤。 如果您在模式視窗中至少不包含這些按鈕之一,JMP 會新增一個好的按鈕。
刪除 w << closeWindow;從您的更新字串按鈕。 如果您希望在按下該按鈕時關閉視窗(您將有不必要的「確定」按鈕),請新增「確定」按鈕,然後向其發送按一下訊息。 我想如果你願意的話你甚至可以隱藏「確定」按鈕
Names Default To Here(1);
// Defining firstname and lastname string
userFirstName = "XXXX";
userLastName = "YYYY";
//changing username variables based on user input
w = New Window("prototype",
<<MODAL></MODAL>
回覆:如何顯示一個文字框,要求使用者輸入。嗨,賈莫,
謝謝你! 這真是一種享受! 然而,我現在遇到了另外兩個問題。 如果我可以描述一下它們的話:
// Defining firstname and lastname string
userFirstName = "XXXX";
userLastName = "YYYY";
//changing username variables based on user input
w = New Window( "prototype", <<MODAL></MODAL>
首先,按更新字串確實會輸出正確的表,但也會引發錯誤:

其次,如果我使用變數 userFirstName 和 userLastName,腳本“有效”,即執行多個文件導入,但如果我在連接字串中使用 b1、b2,則該腳本不起作用。 我的猜測是,我用來定義 b1、b2 變數(使用文字編輯框)的部分是本地的。 b1,b2 變數不會繼續存在於剩餘的腳本中嗎? 如果是這種情況,我該如何使它們作為全域變數存在。
我該如何消除錯誤? 這似乎是由我向視窗添加 << 模態子句引起的。 但我需要這樣做才能暫停腳本並允許操作員檢查他們的姓名輸入是否正確。
理想情況下,我嘗試建立的工作流程是:
用戶運行腳本
該腳本會彈出一個彈出框,要求使用者定義他們的名字和姓氏
該腳本允許用戶檢查他們的輸入是否正確(顯示 filePathString 會比當前輸出更好)
用戶按一下「確定」後,該腳本將繼續,並在幾個不同的 filePathString 中使用新變數。
為了實現我的目的,我可以透過許多其他方法將資料輸入文字方塊合併到此腳本中,因此我們將不勝感激。
謝謝,
晚的
回覆:如何顯示一個文字框,要求使用者輸入。您將 Send 發送到那裡,因為它是正在「評估」到表中的內容(<< 表示發送() )很可能只需用 Eval List() 包裝清單來評估其中的值就足夠了
Names Default To Here(1);
// Defining firstname and lastname string
userFirstName = "XXXX";
userLastName = "YYYY";
//changing username variables based on user input
w = New Window("prototype", // opens a window with a title and this content...
Border Box(top(20), bottom(20), Left(20), Right(20), // window dressing
V List Box( // V and H lists nest to organize the display boxes
H Center Box(Text Box("Report Generator")), // a second title, centered
Spacer Box(size(1, 30)), // a little vertical space
H List Box(Text Box("First Name: "), b1 = Text Edit Box(userFirstName)), // data entry
Spacer Box(size(1, 10)), // a little vertical space
H List Box(Text Box("Last Name: "), b2 = Text Edit Box(userLastName)), // more data entry
Spacer Box(size(1, 30)), // a little vertical space
H Center Box( // center the button
Button Box("Update Strings", // this script runs when the button is pressed...
// make a new table with the values...
dt = New Table("StringCheck",
New Column("Name",
Character,
Set Values(Eval List({b1 << get text(), b2 << get text()}))
)
);
// optionally, close the dialog. Or, you might want to run it again...
w << closeWindow; // just the dialog, not the report
)
)
)
)
);
回覆:如何顯示一個文字框,要求使用者輸入。嗨克雷格,
我希望回覆舊線程沒問題。 我想創建一些變量,以便稍後在腳本中用作字串(文件導入的用戶目錄會根據用戶而變化) - 我正在嘗試調整您的腳本來實現此目的。
這個想法是首先使用預設值來建立變數。 然後輸入框出現,用戶更改值,腳本繼續並在導入中使用現在更新的變數。
//Import multiple files
Multiple File Import(
<<SET folder=""></SET>
所以下面將在腳本中首先出現:
// Defining firstname and lastname string
userFirstName = "XXXX";
userLastName = "YYYY";
//changing username variables based on user input
w = New Window( "prototype", // opens a window with a title and this content...
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ), // window dressing
V List Box( // V and H lists nest to organize the display boxes
H Center Box( Text Box( "Report Generator" ) ), // a second title, centered
Spacer Box( size( 1, 30 ) ), // a little vertical space
H List Box( Text Box( "First Name: " ), b1=Text Edit Box( userFirstName ) ), // data entry
Spacer Box( size( 1, 10 ) ), // a little vertical space
H List Box( Text Box( "Last Name: " ), b2=Text Edit Box( userLastName ) ), // more data entry
Spacer Box( size( 1, 30 ) ), // a little vertical space
H Center Box( // center the button
Button Box( "Update Strings", // this script runs when the button is pressed...
// make a new table with the values...
dt = New Table( "StringCheck", New Column( "Name", Character, Set Values( {b1<< get text(), b2 << get text()} ) ) );
// optionally, close the dialog. Or, you might want to run it again...
w << closeWindow; // just the dialog, not the report
)
)
)
)
);我成功地獲得了資料輸入視窗和一個名為 StringCheck 的表,其中包含字元列“Name” - 但是這兩個值是“Send”:

我嘗試了一些不同的方法來讓它發揮作用,但我一生都無法弄清楚「發送」是從哪裡來的。
任何幫助表示讚賞,謝謝,
晚的
回覆:如何顯示一個文字框,要求使用者輸入。嗯。 我想知道我是否測試了 JSL。 當欄位變更時,NumberEditBox 不會更新 v1/v2 變量,因此報告始終相同。 這應該是這樣的:
v1 = 30; // two numbers with default
v2 = 40; // values; these will go in a data table
w = New Window( "prototype", // opens a window with a title and this content...
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ), // window dressing
V List Box( // V and H lists nest to organize the display boxes
H Center Box( Text Box( "Report Generator" ) ), // a second title, centered
Spacer Box( size( 1, 30 ) ), // a little vertical space
H List Box( Text Box( "value 1: " ), b1=Number Edit Box( v1 ) ), // data entry
Spacer Box( size( 1, 10 ) ), // a little vertical space
H List Box( Text Box( "value 2: " ), b2=Number Edit Box( v2 ) ), // more data entry
Spacer Box( size( 1, 30 ) ), // a little vertical space
H Center Box( // center the button
Button Box( "make report", // this script runs when the button is pressed...
// make a new table with the values...
dt = New Table( "Untitled", New Column( "a", Set Values( {b1<<GET></GET>
使用額外的 b1 和 b2 變數來記住這些框,以及發送到這些框的 <
The report isn't created until after the button is pressed. Artistic license.按下按鈕後才會建立報告。 藝術許可。
回覆:如何顯示一個文字框,要求使用者輸入。該線程似乎還有另一個實例這裡。 另請參閱我在那裡發布的回應。
回覆:如何顯示一個文字框,要求使用者輸入。您可以使用自訂提示在 JMP 中建立模態或非模態對話方塊。
模態對話框不會讓您執行任何其他操作,直到您完成它們。 http://www.jmp.com/support/help/Modal_Windows.shtml
非模式對話方塊可讓您在其他視窗中工作並稍後返回非模式視窗: http://www.jmp.com/support/help/Constructing_Display_Trees.shtml#259363
您所描述的非模態原型可能如下所示:
v1 = 30; // two numbers with default
v2 = 40; // values; these will go in a data table
w = New Window( "prototype", // opens a window with a title and this content...
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ), // window dressing
V List Box( // V and H lists nest to organize the display boxes
H Center Box( Text Box( "Report Generator" ) ), // a second title, centered
Spacer Box( size( 1, 30 ) ), // a little vertical space
H List Box( Text Box( "value 1: " ), Number Edit Box( v1 ) ), // data entry
Spacer Box( size( 1, 10 ) ), // a little vertical space
H List Box( Text Box( "value 2: " ), Number Edit Box( v2 ) ), // more data entry
Spacer Box( size( 1, 30 ) ), // a little vertical space
H Center Box( // center the button
Button Box( "make report", // this script runs when the button is pressed...
// make a new table with the values...
dt = New Table( "Untitled", New Column( "a", Set Values( {v1, v2} ) ) );
// launch a platform to analyze the data...
dt << Distribution( Continuous Distribution( Column( :a ), Quantiles( 0 ), Summary Statistics( 0 ), Vertical( 0 ), Outlier Box Plot( 0 ) ) );
// optionally, close the dialog. Or, you might want to run it again...
w << closeWindow; // just the dialog, not the report
)
)
)
)
);
Prototype dialog原型對話框