You specify the response to termination response definition within a block if you want an action to occur whenever that block is left implicitly.
In the following example, the user has two objects on the screen: Name and Number. If the user first selects Name and then selects Number (which causes the program to implicitly leave the block in the response to Name statement), response to termination will clean up the screen by making TypeName invisible.
enabled graphical region Name size 50 20
at position 0 100 border
invisible disabled key TypeName at position 10 10 in Name
...
enabled graphical region Number size 50 20
at position 100 100 border
response to Name
make TypeName visible
begin
response to char "\n" from keyboard
leave block
response to char from keyboard
add to TypeName
text input
response to termination
make TypeName invisible
end
response to Number
...
The response to termination response definition cannot contain a block, nor can it contain a reference to any action routine which contains a block. If it does, an irrecoverable runtime error may occur, and no error message will be generated.