Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I knew controls are created before the form that contains them, but...

Status
Not open for further replies.

CBU64

IS-IT--Management
Apr 30, 2001
19
MX
in this case, I created a navigation class for my apps.

Using form designer, I instantiated this class, initiated it and I've using it regularilly (in my current form and in previous).

Today, making some minor changes in my app, the code in my form's active method (which references some properties in the navigation class that I mentioned previously) is sending me an error "XXX is an unknown member".

Using the debugger, I check objects and classes already instantiated onto my form and my navigation class is not present. Ignoring further error messages, my navigation class "suddenly" appears.

I can´t find which event triggers its instantiation, neither why it's not instantiated from the very beginning, before the active event code.

It was working OK 'till saturday.

What can be wrong? Have I changed something that I forgot in my class that is caussing this behavior?

Take away all the buzz of this biz and what do you get? 01000100101010...
 
What do you have in the form's load? The order of execution is LISA - Load Init Show Activate. If you refer to your class in the load, it may not be there yet.

Ken
 
No code in the load method. I have code in the form's init & activate.


Take away all the buzz of this biz and what do you get? 01000100101010...
 
It should not give you any problems then. I assume that this navigation class runs error free in other forms. Does it? If it runs in other forms, then there has to be something in this form that is causing it to fail.

Ken
 
So what happens if you remove those 'minor' changes? Does it once again work like it's supposed to?

And what are those minor changes? Maybe we could get a better idea if you wer to post some examples.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Dave: I undid my minor changes (really, I was updating text on a status bar...) but it didn't fix a thing :(

Belive it or not, I found a "solution":

Beside this object (record navigator) my form owns a pageframe control (with 4 pages).

Normally, in order to show my navigator in front of everypage page of the pageframe control, I set ZOrder of the navigator in front of every control (Format -> Bring to front).

Accidentally, by cutting and pasting my pageframe, I set the pageframe in front of my navigator and ran my app, and alas! My form ran smoothly as it used to.

Any clue? Has it something to do with the order that VFP (6.0 in my case) form designer creates records on a .SCT table?

I am really annoyed.

Take away all the buzz of this biz and what do you get? 01000100101010...
 
Yes, controls are instantiated in a particular order. You can see the order by turning on Event Tracking. Instantiation of one control shouldn't depend on another control already existing.

Tamar
 
It can make a BIG difference if say, the nav bar references this.parent, or this.parent.somecontrol.recordsource. If it is on the page frame, this.parent is a page. However, if the page frame is over the top of the nav bar, this.parent becomes the form itself.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
I can see your point Tamar, but in this case, as I wrote previously, I expected to rely in something: objects in a form are instantiated BEFORE form activates itself, aren't they?

Take away all the buzz of this biz and what do you get? 01000100101010...
 
You're right Dave.

But I didn't mention that my nav control was contained into a pageframe (actually, it would've been contained into one of its pages).

What I meant was that it stop working when it's OVER the pageframe. I restarted working when I pasted it UNDER the pageframe (in a hidden way).


Take away all the buzz of this biz and what do you get? 01000100101010...
 
Yes, all the controls are instantiated before the form itself, or to be more accurate, the control's Init methods fire before the form's Init method. I'm not sure in what order the objects are actually created and initialized with their property sheet values.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top