Difference between revisions of "AskMsgChoice"

(combo box parameter)
(More spec)
Line 11: Line 11:
 
* «title» : The caption for the dialog.
 
* «title» : The caption for the dialog.
 
* «optionsList»: An unindex list, or a 1-D array, containing the possible options.  It can be an expression that computes such a list.  Numbers are coerced to text using the number format for the variable currently being evaluated.
 
* «optionsList»: An unindex list, or a 1-D array, containing the possible options.  It can be an expression that computes such a list.  Numbers are coerced to text using the number format for the variable currently being evaluated.
* «default» (optional): The item from the choice list that should be selected initially.  Defaults to "All" when «showAll» is true, or to the first item otherwise.  Unless «allowAnyText» is true, an error is issued when the value does not exist in «optionsList».
+
* «default» (optional): The item from the choice list that should be selected initially.   
 
* «showAll» : (optional boolean, default: false): Indicates whether the "All" option should appear on the dropdown.
 
* «showAll» : (optional boolean, default: false): Indicates whether the "All" option should appear on the dropdown.
 
* «anyTextOk» : (optional boolean, default:false): When this is true, a ComboBox is displayed.  The «optionsList» is a dropdown with suggested values, but any value may be typed.  When true, «default» does not have to be in the «optionsList».
 
* «anyTextOk» : (optional boolean, default:false): When this is true, a ComboBox is displayed.  The «optionsList» is a dropdown with suggested values, but any value may be typed.  When true, «default» does not have to be in the «optionsList».
Line 20: Line 20:
  
 
When called from ADE, this function does not present any UI, and simply returns the default selection.
 
When called from ADE, this function does not present any UI, and simply returns the default selection.
 +
 +
When «anyTextOk» is not specified, or is false, a straight pull-down is displayed.  In this case, «default» must be in «optionsList» or an error is issued.  When «default» is omitted, it defaults to "All" when «showAll» is true, or to the first selection otherwise.
 +
 +
When «anyTextOk» is false, a combobox is displayed, which contains both a single-line text entry field and a pulldown.  The pulldown serves as list of suggestions, but any (single-line) of text may be entered.  When an item on the pulldown is selected, its value appears in the text field.  The «default» value does NOT need to be in «optionsList».  When omitted, "All" is selected if «showAll» is true, otherwise the initial field is blank.
 +
 +
The width of the dialog and the pulldown/text control adapts to the length of the available options.  The pulldown appears wide enough to accommodate both the longest text in «optionsList» and the «default» value up to a point.  When the length of these would result in a dialog exceeding the lesser of 1000 pixels or the width of the monitor, then the width is limited to that amount.  In the pure pulldown case, the text of the displayed suggestion is truncated.  The width of the popup does not need to be constrained by this same limit, but should be fully visible on the monitor, truncating when necessary.
  
 
= Examples =
 
= Examples =

Revision as of 23:46, 17 August 2011


new to Analytica 4.4

AskMsgChoice(question,title,optionsList,default,showAll,anyTextOk)

When evaluated, a pop-up dialog asks the user to select from a drop-down of possible choices.

Parameters:

  • «question» : Text that appears in the dialog body itself, above the choice pulldown.
  • «title» : The caption for the dialog.
  • «optionsList»: An unindex list, or a 1-D array, containing the possible options. It can be an expression that computes such a list. Numbers are coerced to text using the number format for the variable currently being evaluated.
  • «default» (optional): The item from the choice list that should be selected initially.
  • «showAll» : (optional boolean, default: false): Indicates whether the "All" option should appear on the dropdown.
  • «anyTextOk» : (optional boolean, default:false): When this is true, a ComboBox is displayed. The «optionsList» is a dropdown with suggested values, but any value may be typed. When true, «default» does not have to be in the «optionsList».

The result returned is the selected label from «optionsList», unless "All" is selected, in which case the result is the same value supplied as «optionsList».

The dialog includes an OK and a Cancel button. When Cancel is pressed, the current in-process computation is aborted.

When called from ADE, this function does not present any UI, and simply returns the default selection.

When «anyTextOk» is not specified, or is false, a straight pull-down is displayed. In this case, «default» must be in «optionsList» or an error is issued. When «default» is omitted, it defaults to "All" when «showAll» is true, or to the first selection otherwise.

When «anyTextOk» is false, a combobox is displayed, which contains both a single-line text entry field and a pulldown. The pulldown serves as list of suggestions, but any (single-line) of text may be entered. When an item on the pulldown is selected, its value appears in the text field. The «default» value does NOT need to be in «optionsList». When omitted, "All" is selected if «showAll» is true, otherwise the initial field is blank.

The width of the dialog and the pulldown/text control adapts to the length of the available options. The pulldown appears wide enough to accommodate both the longest text in «optionsList» and the «default» value up to a point. When the length of these would result in a dialog exceeding the lesser of 1000 pixels or the width of the monitor, then the width is limited to that amount. In the pure pulldown case, the text of the displayed suggestion is truncated. The width of the popup does not need to be constrained by this same limit, but should be fully visible on the monitor, truncating when necessary.

Examples

AskMsgChoice("What is your favorite color?", "Select color", ['Black','Blue','Brown','Cyan','Green','Orange','Red','White','Yellow'], 'Green')

See Also

Comments


You are not allowed to post comments.