Navigation:  Reference > Commands >

Quit Program

Print this Topic Previous pageReturn to chapter overviewNext page


Provide a process for exiting a program.


QUITNo Options / No Modifiers



TAS Professional will NOT automatically exit a program.  You must execute a QUIT command or the user must click the close button on the main screen for the program.  The QUIT command doesn't actually do anything immediately.  It tells the runtime that you want to exit this program as soon as possible.  When you RET (return) from the routine you are running the main screen (and all sub-screens) for that program will be closed, the open files will be closed, and the program will be removed from memory.


If you CHAINed to this program from another that previous program's active screen will be brought to the front and you will be able to continue with that program.


If this was the MainMenu then the runtime will exit completely.


NOTE:  You may not quit a program when a modal form is active.  You must first exit from that form.  An error will be displayed should you try.



If you have a button called btnQUIT then the following might be your code:






You might also have an OnClose routine for this form.  If so it might be something like this:



 if x>1

   msg 'The program cannot close yet.  You need to do...'

   ret .false.


 //if we're here then we can close

 ret .true.


In that example above when the form gets the message to close (QUIT) it will call the subroutine above.  If the variable x has a value greater than 1 the routine returns .FALSE. which tells the form that it can't close and the program stays active.  The routine also sends a message to the user to tell him/her that the program isn't finished yet.  The label 'CheckOnClose' is something you would set in the form object itself, please refer to TTASForm.



Page url: