v5.0
VBScript の InputBox を他のスクリプト言語に出力します。 ユーザから情報を取得する場合に便利な関数です。 質問を含むのモーダル ダイアログ ボックスおよびユーザがデータを入力できる編集ボックスが表示されます。
注: バッチモード XSIInputBox を実行する場合は、デフォルト引数の値が戻されるのみです。
ヒント: ファイル パスやカラー、リスト外のオプションなどのより高度な情報をユーザから収集するには、CustomProperty を作成するか、XSIUIToolkit または XSIDialog オブジェクトのサービスを使用します。
oString = XSIInputBox( [Prompt], [Title], [Default] ); |
ユーザにより入力されたString。ユーザがキャンセルした場合や指定しなかった場合は空の文字列が戻されます。
| パラメータ | タイプ | 説明 |
|---|---|---|
| Prompt | 文字列 | ユーザに指定してもらう必要があるテキスト |
| Title | 文字列 | ダイアログ ボックスのタイトル バーに表示するテキスト |
| Default | 文字列 | ユーザに提示する値。バッチ モードで実行する場合にはこの値が自動的に戻されます。 |
/*
Example showing how to ask the user for a unique name for a grid object. A loop is used to give
the user another chance if they pick the name of an existing object
*/
while(true)
{
var strObjName = XSIInputBox(
"Please pick a name for the new object",
"Time for a Decision",
"Foo" ) ;
if ( strObjName != "" )
{
var oExisting = Dictionary.GetObject( strObjName, false ) ;
if ( oExisting == null )
{
ActiveSceneRoot.AddGeometry( "Grid","MeshSurface", strObjName ) ;
break ;
}
else
{
XSIUIToolkit.MsgBox( "That object already exists\n"+
"You have to think of a new name" ) ;
}
}
else
{
// User cancelled
break ;
}
} |
' ' Example showing how to ask the user for a unique name for a grid object. A loop is used ' to give the user another chance if they pick the name of an existing object ' do while true strObjName = XSIInputBox( _ "Please pick a name for the new object", _ "Time for a Decision", _ "Foo" ) if strObjName <> "" then set oExisting = Dictionary.GetObject( strObjName, false ) if typename( oExisting ) = "Nothing" then ActiveSceneRoot.AddGeometry "Grid","MeshSurface", strObjName exit do else XSIUIToolkit.MsgBox( "That object already exists" & vbCrLf & _ "You have to think of a new name" ) end if else ' User cancelled exit do end if loop |