In a previous blog we used the Note statement, which is the most basic of MapInfo’s standard dialogs. The Help section on Dialogs states: - “The Dialog statement lets you create a custom dialog box. If you want to display a standard dialog box (for example, a File>Open dialog box), use one of the following statements or functions: Ask() function, Note statement, ProgressBar statement, FileOpenDlg() function, FileSaveAsDlg() function, or GetSeamlessSheet() function).”
The Ask() function displays a dialog box which asks the user a yes or no question. The example in the Help section is as follows:-
Dim more As Logical
more = Ask("Do you want to continue?", "OK", "Stop")
This code by itself will not show an Ask dialogue box so please do not try and run this example. This is because it will cause MapInfo to run the program in the background without displaying the Ask dialogue box. The code will compile and can be run, but with the result of having to reboot your computer to cancel the code from the system. If curiosity gets the better of you and you run this code you will only be aware of the problem as the MapInfo icon at the bottom of your computer screen will flash intermittently. If you attempt to close MapInfo you will get a message saying that you cannot quit MapInfo. You can resolve the problem by restarting which will close MapInfo and the underlying problem. Needless to say you are better off just accepting that this code is to be run only as part of a larger section of code as shown in the code sample below:-