This command displays a standard Windows dialog box with Yes and No buttons.
|Required - You may use this in two ways. It can be an A type field and the program will display the field as the message. It can also be a numeric value (any appropriate type), and the program will read the appropriate record in the ERRMSG.B file. The value you set must relate to the ERROR_NUM field in the ERRMSG record.
|The normal default response to this command is .TRUE.. This would be the case if the user pressed just the RETURN or ENTER key without entering a value. If you would like the default response to be N (.FALSE.) then this value must be set to .FALSE.
|You can replace the caption of the box using this option. If you don't specify a caption the word "Ask" will be displayed.
|This option will allow you to override the buttons you have setup in the TP7SETUP program.
LEFTBUTTON f/c/e This option allows you to change the caption on the left button. NOTE: The result if the user clicks on the left button will still be True in the ASK() function.
RIGHTBUTTON f/c/e This option allows you to change the caption on the right button. NOTE: The result if the user clicks on the right button will still be False in the ASK() function.
You can test the user's response to the message through the ASK() function. If the ASK() function returns .TRUE. the user answered Y to the question; if .FALSE., N.
If you change the LEFTBUTTON or RIGHTBUTTON values the button widths will be automatically reset and the buttons repositioned on the dialog box.
This code with create the dialog box that follows.
ask 'Do you want to save the record?' dflt .false.
You can override the TP7SETUP settings through the use of the USE option. If you have the Yes/No option chosen in Setup, but want to use Ok/Cancel for this question, then you would change the example above to look like:
ask 'Do you want to save the record?' dflt .false. use 'ok' caption 'Save?'
And, to go from Ok/Cancel to Yes/No you would change that to:
ask 'Do you want to save the record?' dflt .false. use 'yes' caption 'Save?'
ASK f/c/e CAPTION f/c/e DFLT f/c/e LEFTBUTTON f/c/e RIGHTBUTTON f/c/e USE f/c/e