GetTrueFalse


The GetTrueFalse function opens a dialog showing a True or False choice to be made. This function returns the choice and the button that was clicked. All text labels can be configured or defaults can be used.

 

Syntax

bTrue, bSuccess = GetTrueFalse()

bTrue, bSuccess = GetTrueFalse( bInit )

bTrue, bSuccess = GetTrueFalse( bInit, sLabels )

bTrue, bSuccess = GetTrueFalse( bInit, sLabels, sPrompt )

bTrue, bSuccess = GetTrueFalse( bInit, sLabels, sPrompt, sTitle )

where

    bInit is the initial choice (true or false). If omitted, false is assumed.

    sLabels is the list of 2 choice labels, separated by \n. If nil, "True" and "False" are used.

    sPrompt specifies a message above the choices. If nil, a default prompt is used.

    sTitle specifies the window title. If nil, a default is used.

    bTrue is the user's choice of True or False.

    bSuccess is an optional success flag. If [OK] is clicked, the function returns bSuccess=true. If the dialog is canceled bSuccess is false and bTrue is false.

  

Note that the position of the default value and the label string is reversed in comparison with GetChoice and GetItem dialogs. This is done so that only the initial true/false value need be specified.

All arguments following sLabels are optional. Defaults are used beyond the last specified argument. To use a default argument but follow it with a specified argument, use a nil in its place.

The sLabels argument specifies the strings to be used for the 2 bullet labels. These labels are specified in one string separated by a new line character \n, with the true label first. For example, to specify the labels as "The True Choice" and "The False Choice", pass the sLabels argument as

     "The True Choice\nThe False Choice".

 

The choice is returned as bTrue = true or false. The user's button click is returned as bSuccess. If [OK] is clicked then bSuccess=true. Otherwise, if the user clicks [Cancel], then bSuccess=false.

Example

The upper window shown above was created using mostly the defaults:

  bTrue, bSuccess = GetTrueFalse( true )

-- initial choice is specified

 

 

Related Topics

GetItem

GetChoice