Purpose
Displays a dialog box, asking the user a yes or no (OK or Cancel) question. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
Ask( prompt, ok_text, cancel_text )
prompt is a string to appear as a prompt in the dialog box.
ok_text is a string (e.g., "OK") that appears on the confirmation button.
cancel_text is a string (e.g., "Cancel") that appears on the cancel button.
Return Value
Logical
Description
The Ask() function displays a dialog box, asking the user a yes-or-no question. The prompt parameter specifies a message, such as "File already exists; do you want to continue?" While the length of the prompt string passed to the Ask function can be approximately 2000 characters long,only the first 299 will display in the dialog.
The dialog box contains two buttons; the user can click one button to give a Yes answer to the prompt, or click the other button to give a No answer. The ok_text parameter specifies the name of the Yes-answer button (e.g., "OK" or "Continue"), and the cancel_text parameter specifies the name of the No-answer button (e.g., "Cancel" or "Stop").
If the user selects the ok_text button, the Ask() function returns TRUE. If the user clicks the cancel_text button or otherwise cancels the dialog box (e.g., by pressing the Esc key), the Ask() function returns FALSE. Since the buttons are limited in size, the ok_text and cancel_text strings should be brief. If you need to display phrases that are too long to fit in small dialog box buttons, you can use the Dialog statement instead of calling the Ask() function. The ok_text button is the default button (the button which will be selected if the user presses Enter instead of clicking with the mouse).
Example
Dim more As Logical
more = Ask("Do you want to continue?", "OK", "Stop")
See Also:
Dialog statement, Note statement, Print statement