>The problem is that you have the GATHER MEMVAR code executed before the
>CLEAR READ code, and thus it is saved before it is checked.
>
>1) Remove the GATHER MEMVAR code from the Save button
>2) Have a check for the {Esc} key in the READ VALID, thus:
>
>if mod(readkey(),256) # 12
> * Esc was not pressed, proceed with validation
>endif
>
>> In Foxpro 2.6 for Windows. I am trying to have a screen level
>> validation
>> that checks some things before the screen closes. I entered a logical
>> statement into the screen valid section of the screen generator. I
>> also
>> have some buttons ( for example a save/exit button).. The save exit
>> button contains:
>>
>> GATHER MEMVAR
>> CLEAR READ
>>
>> When the save exit button is pressed the screen level validation
>> clause IS
>> NOT executed
>>
>> When I press ESC to exit the screen the screen level validation IS
>> EXECUTED
@ 1,1 get m.dummy default " " valid myudf()
read valid .F.
? "read terminated without validation of .F."
function myudf
clear read && read valid won't be fired
It doesn't matter what you do before or after a clear read when a clear read follows @... get statements. This "read valid" will never be executed but a foundation "read valid" will.