A newer version of Max is available. Click here to access the latest version of this document.


Open a dialog box for text entry


dialog makes a symbol out of the text you type in (or a message if you set the right inlet to 1) and sends it out the outlet when you click on the OK button in the dialog box. (Note that the output of a dialog object is not directly "caused" by sending the object a message, so you can't count on it happening by a certain time.)


Name Type Opt Description
label symbol opt Sets the prompt which will appear above the text entry box in the dialog window.


bang In left inlet: Opens the dialog box with the previous text displayed as the default.
int default-text [int]
In left inlet: Same as symbol.
  (inlet1) output-format (0 or 1) [int]
In right inlet: The number 0 sets dialog so that whatever the user types into the dialog box is sent out as a symbol preceded by the word symbol. A non-zero number sets dialog so that the typed-in text is sent out exactly as is if it begins with a word, or preceded by the word list if it begins with a number. If no number is received, it is considered 0 by default.
float default-text [float]
In left inlet: Same as symbol.
symbol default-text [symbol]
In left inlet: The word symbol, followed by any word, opens a dialog box prompting the user to enter text. The word following symbol is shown as the default text. If you want more than one word to appear as the default text, you must enclose the words in double quotes.

Information for box attributes common to all objects


bang: If the dialog box is cancelled by the user, a bang message is sent out the right outlet.
symbol: If the user clicks OK, dialog makes a symbol out of the entered text (even if it's a number or it's more than one word) and sends it out its outlet with the word symbol prepended. If a non-zero number has been received in the right inlet, the typed-in message is sent out as is (without being preceded by the word symbol). This message can be displayed by prepending the word set and sending it to a message box (as shown in the example). If the user clicks Cancel, nothing is sent out.

Since your patch continues to run while waiting for the user to type text into your dialog box, you can't count on getting the typed-in symbol immediately after sending the message that opens the dialog box.


Typed-in message is sent out when OK button is clicked other processes continue while dialog box is open A dialog box is opened by the dialog object

See Also

Name Description
message Send any message
opendialog Open a dialog to ask for a file or folder
savedialog Open a dialog to ask for a filename for saving
sprintf Format a message of words and numbers