Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form.activate runs on it's own at different times
Message
From
05/08/2003 14:30:48
 
 
To
05/08/2003 02:03:05
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00816555
Message ID:
00817000
Views:
19
>>I have seen this happen to me many times in 6, 7, and now VFP8. I change some code in some areas. I then run and get errors to find out that an area of code that I didn't even change and has nothing to do with the part I was coding in any way (via step on) is caused by the activate of the form being initiated again, yet there is nothing in the code now as there was not before that would tell the code to re-run the activate of the form (which is what causes the errors because there is code in the activate which I would not want to run at that time). I usually spend some time and figure out a work around, but that takes time and it is annoying to bandaid this with no explanation as to why it does that.
>>
>>Can anyone tell me why this occurs?
>
>Kevin, not sure if you are aware of this: the form.activate event does not only occur when the form is first displayed. It is run every time the form loses focus and regains focus, i.e. is re-activated.
>
>For a simple demo of this create two non-modal forms which each have an activate event that simply displays a message on the VFP desktop identifying what form it is, either form 1 or form 2. Now load both forms and click between them and you will see that the activate event is being called for each one everytime you give it focus.

>
>So, if you have something in your code that lets the form lose focus and then it regains focus then your activate event is going to fire. This event should only contain code that should happen when the form gains focus.

_________________________________________________________________
I have noticed that activate occurs just like the gotfocus of the form, but what I don't understand is why code which has not changed does not loose focus on the form and return to it (hence calling the activate procedure of the form) then all of a sudden it begins doing this when I add code in other places, but have not changed any code in the module that now causes the activate, and that the code I am changing has nothing to do with the part of the code that is now calling the activate procedure of the form.
``` Appreciate a normal day, it is always better than a bad one ```

Kev
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform