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 02:03:05
 
 
To
04/08/2003 13:12:27
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00816555
Message ID:
00816727
Views:
21
>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.
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform