Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Moved event before Init()?
Message
From
11/02/2002 13:56:13
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00617898
Message ID:
00618485
Views:
10
David,

The reason that it seems odd to me is that there is nowhere that Top or Left are set/changed EXCEPT in my code that is invoked in the Init(). The form is not from a sub-class and the property sheet is not previously manipulated.
Now I just checked the property sheet and both had bold 0s in them, so I suppose that I may have set them to 0 at some point. Sure don't remember doing so, but I guess it's possible. That would put your rule1 in effect.

Update: I just found that moving the form in the development window causes the values to change accordingly. Now I can agree that I caused a change in these, as I sometimeshave mouse moments that come unexpectedly and require me to put thingas back to where they were.

The basic sequence involved here is:
MAIN starts and invokes a Login form.
After a successful Login my application object is instantiated.
- This takes a Memo from the Login table entry and puts it into an application onject property.
Then the Do FORM is issued, which has (had) a Moved() event coded to amend the aforementioned property whenever the form was moved.
- Now the Init() of the form has code to set the Top and Left positions based on the content of the property (invokes a method of the app. object to do it). It was always getting 0,0 as the values yet a coverage log of the Init() code showed no Moved() event being executed! A check showed that the correct values had been stored into the memo field (and thus the property) initially.
- A WAIT window in the Moved() code confirmed that a move to 0,0 was causing the code to execute (thus revising the property values to 0,0) but this was obviously happening before the Init() based on the coverage log.

In any case, I will live by the rules you list in the future.

Thanks



>
>I think these couple of rules will help define for you what's happening.
>
>Property values set via the property sheet occur before the Init() event for an object. These happen for every level of your class hierarchy.
>
>Setting .Left or .Top is going to trigger the Moved() event. Just like setting .Height or .Width is going to trigger .Resize().
>
>Have you anywhere in the form class hiearchy set either .Top or .Left to 0, in code or on the property sheet?
>
>>Not as I can tell/see. The coverage log NEVER went to Moved() through the whole Init().
>>In addition, it DID execute my method for the new placement of the form and later testing showed that the input to it are Top=0 and Left=0 despite the fact that the memo field (loaded to a property of my 'framework' in MAIN) does have other values at startup (but the Moved() event code *does* (well, did, until I made the change you suggested) change the values in the property).
>>So I can only conclude that the Moved() event was triggered BEFORE the Init() event and that does not seem correct (or at least logical) to me.
>>
>>It's not a problem doing it the smart way (at close only) so now it is only a matter of academic interest.
Previous
Reply
Map
View

Click here to load this message in the networking platform