AskMsgText
| Release: |
• 4.6 • 5.0 • 5.1 • 5.2 • 5.3 • 5.4 • 6.0 • 6.1 • 6.2 • 6.3 • 6.4 • 6.5 • • 6.6 • 7.0 • 7.1 • 7.2 |
|---|
AskMsgText(question, title, maxText, default, password, checkboxText, initialCheck, multiline, sensitive)
A Dialog Function that creates a dialog box with «title», «question» and a text box. It returns the text entered by the user into the text box, or the default if none. For example:
AskMsgText("Enter your model access key", title: "License Entry", maxText: 15)
The box displays OK and Cancel buttons. Pressing Cancel causes the current computation to abort.
The message box appears only when this function is evaluated. Since Analytica caches results once they are computed, if you embed this in a variable, you will not see the question every time you view the result. To trigger the question again, you must change something upstream that the variable depends on, so the result is invalidated. If you place it inside an OnClick in a button or OnChange attribute in a variable, it shows the message box every time the button is pressed.
Optional parameters
«title»: A title for the dialog box. (Default: empty.)
«default»: The default text shown in the message box. (Default: empty.) If the default has multiple lines -- i.e., one or more Chr(13) characters -- the text box will be placed in multiline entry mode (unless «multiline» is specified as 0).
«maxText»: The maximum number of characters accepted. (Default: unlimited)
«password»: If set to true, it obscures the characters typed, showing asterisks rather than the typed characters. It also implies «sensitive», so a masked prompt is kept out of the Analytica Command Line/Automation trace log.
«checkboxText»: If specified, shows this text with a checkbox. (Default: empty and it does not show the checkbox.) (New to Analytica 5.4) When you specify «checkboxText», it returns two return values: The text from the text box, and the Boolean state of the checkbox. To capture both, use for example
Local (enteredText, checked) := AskMsgText("Enter the plant name", checkboxText:"Is a co-generation facility");
«initialCheck»: Initial state (true or false) of checkbox. (Default: False i.e. Off).
«multiline»: The number of lines for the text box. Forces it into multi-line entry mode. A value of 0 forces single-line entry mode even if the «default» text has multiple lines.
«sensitive»: Set this to True when the «question» text, or the text you are asking the user to type, is confidential -- a prompt that embeds an account number, say, or an entry field for a one-time access code. It changes nothing about the dialog itself. What it changes is the Analytica Command Line/Automation trace log, which records «sensitive» in place of the prompt and in place of the text entered, so the confidential text never reaches the log file. (New to Analytica 7.2)
«sensitive» defaults to «password». An entry you have chosen to mask is confidential by definition, so a password prompt stays out of the automation log without your having to ask for it. The two flags still do different jobs -- «password» hides the text on the screen as it is typed, «sensitive» keeps it out of the log -- and you can separate them; it is only the unusual direction that you have to spell out:
AskMsgText( "Enter the password for " & Account, password: True, sensitive: False )
which masks the entry on screen but records the prompt in the log as usual.
Note that «title» is always written to the log, whatever «sensitive» says, since that is what identifies the dialog there. Keep confidential text out of the title.
A handler registered with RegisterAutomationModalHandler still receives the real prompt text, along with a sensitive field that is True -- so a handler that keeps its own log can leave the text out of it too.
From ADE
When evaluated in the Analytica Decision Engine (ADE), it calls IAdeUICallbacks::AskMsgText(...). From within that callback, the parent application can display a dialog, collect input from the end-user, and return that as the return value. To receive the callback, the parent application must have previously registered the callback with ADE using CAEngine::SetCallbackObject( ). If it has not registered a callback, then «default» is returned.
