UserInterface.inputBox Method

Parent Object: UserInterface
Defined in namespace "adsk::core" and the header file is <Core/UserInterface/UserInterface.h>

Description

Displays a modal dialog to get string input from the user.

Syntax

"userInterface_var" is a variable referencing a UserInterface object.
# Uses no optional arguments.
(returnValue, cancelled) = userInterface_var.inputBox(prompt)

# Uses optional arguments.
returnValue = userInterface_var.inputBox(prompt, cancelled, title, defaultValue)
"userInterface_var" is a variable referencing a UserInterface object.

#include <Core/UserInterface/UserInterface.h

// Uses no optional arguments.

// Declare the output arguments.
string prompt;
boolean cancelled;
string returnValue = userInterface_var->inputBox(prompt, cancelled);

// Uses optional arguments.

// Declare the output arguments.
string title;
string defaultValue;

// Call the function.
Ptr<UserInterface> returnValue = userInterface_var->inputBox(prompt, cancelled, title, defaultValue);
"userInterface_var" is a variable referencing a UserInterface object.
// Uses no optional arguments.
[returnValue, cancelled] = userInterface_var.inputBox(prompt);

// Uses optional arguments.
returnValue = userInterface_var.inputBox(prompt, cancelled, title, defaultValue);

Return Value

Type Description
string Returns the string entered by the user but because the user can click Cancel, the canceled argument should be tested before using the string.

Parameters

Name Type Description
prompt string The message text to display in the dialog.
cancelled boolean Indicates if the dialog was canceled.
title string Sets the title for the dialog if specified, otherwise the script or add-in name is used.

This is an optional argument whose default value is "".
defaultValue string The default string that's shown when the dialog is initially displayed, otherwise the input box is empty.

This is an optional argument whose default value is "".

Samples

Name Description
Use inputBox to get value and evaluateExpression to validate it

Uses UserInterface.inputBox to prompt for a string, then validates the entry with UnitsManager.evaluateExpression.

Before running: Run from Scripts and Add-Ins with a design open. The sample is interactive and waits for input in a dialog.

Creates an I-Bream on a User Coordinate System

Demonstrates the use of an existing user coordinate system to create geometry dependent on it.

Before running: Run from Scripts and Add-Ins. This sample may open dialogs or require interactive choices; keep Fusion in the foreground.

Version

Introduced in version August 2014