>>>Hi,
>>>
>>>I have a form that runs a long (sometimes) loop so I want to give user ability to cancel by clicking on a button. I included DOEVENTS in the loop. And I added code to the button click() method to set a form property to a value (e.i. thisform.lCancel = .T.). But the button click never fires no matter how many times I click on this button.
>>>
>>>What am I missing?
>>
>>You may try to set ON ESCAPE llBreak = .t.
>>SET ESCAPE ON
>>
>>SCAN while not llBreak
>>
>>and also set Cancel property of the button to true.
>
>I don't want user to have to press Esc key. I am trying to make it work with a click on the button only.
>
>Thank you.
Only SET KEYS have ability to really interupt the loop. The other alternative is to try to set some flag in button's code and check this flag in the loop.
I think I had this done in the past even without using ESC (the simpliest idea), but I don't recall the details at the moment.
If it's not broken, fix it until it is.
My Blog