>>The helptext of the CLEAR command says:
>>
>>
Issuing CLEAR ALL within an event or method for an active control or object generates a Visual FoxPro error message.>>
>>This bothers me in this situation:
>>1 In the Init() of an object an error occurs.
>>2 The errorhandler offers the option to Abort.
>>3 The Abort has separate code for the runtime situation and the development situation.
>>4 In the development situation I have a line CLEAR ALL.
>>
>>It generates an error without a number: ''Cannot clear the object CMDBROWSE because it is in use."
>>
>>I have unsuccesfully tried several techniques to release the form that contains the object beforehand, for example:
>>
for each loForm in _screen.forms
>> if lower( m.loForm.class ) = "viafrm_viajob"
>> m.loForm.destroy()
>> m.loForm.release()
>> endif
>>next
>>release loForm
>>
>>Advice is welcome.
>
>I tend to keep a little utility program handy to run after an app I'm testing crashes. That's where I put CLEAR ALL (and other stuff).
I think what you're suggesting here is that I run the prg 'by hand' from the command window after the app finishes?
I have tested it and it indeed does not generate the error. I have also tested the use of KEYBOARD, and it works.
The old code:
lcMacro = 'do c'
&lcMacro
CANCEL
The new code:
clear typeahead
keyboard '{CTRL+F2}do c{ENTER}'
CANCEL
Groet,
Peter de Valença
Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.