Wiki Home

VFP Gotchas

Namespace: Wiki
Idiosyncrasies in VFP that may surprise the uninitiated.
See also VFP Rookie Mistakes

Some broad categories
VFP Gotchas Language
VFP Gotchas IDE
VFP Gotchas OOP
VFPGotchasReports - ? (see below)
VFP Gotchas Database

Other Gotchas
DODEFAULT and NODEFAULT seem to behave differently if they are in a class that is a subclass of a VFP baseclass. I think there are 4 levels that have different behavior:
0 = no subclassing, just putting code in the instance of a VFP baseclass.
1 = code in a subclass of a VFP baseclass.
2 = code in a subclass of 1
3-n = code in a subclass of 2 or 3

There may be differences depending on empty methods too. I played around with this enough to get a headache, and hope that someone could define it better.

I hope so too. Here you have defined the possible scenarios but the actual behaviour differences remain unstated. -- Jim Nelson
Linky! DODEFAULT Or NODEFAULT -- Peter Crabtree
Question, is there a difference between 0 and 1 above? AFAIK, under the covers, when you add code to an instance of a baseclass, you're, for all practical purposes, adding code to a subclass. -- Mike Helland
I don't think there's a difference, in practice, other than a couple of slightly different behaviors because of having several controls with the same class in the same container. You are essentially subclassing when you are creating an instance with code - the only difference is that you can't subclass it. Someone please correct me if I'm wrong. -- Peter Crabtree
When you build an exe, the default behavior is for it to create foxuser.dbf in the current dir. It is a good idea to just turn it off in config.fpw, or if you do need it, figure out how to control it's location. (if anyone has a good idea on where/how to do this, I would like to hear it. - cfk )

I agree - use RESOURCE=OFF in config.fpw unless you really need it. To control its location, you can use RESOURCE "filepath" in config.fpw - You can also use SET RESOURCE=ON/OFF and SET RESOURCE TO after VFP starts up. Remember, foxuser.dbf is single user only - if 2 users are pointing to the same resource location, only the first user will be accessing the Fox User .dbf - Personally, I have not found it necessary to utilize resource files in my apps since FPD when I used to provide color and printer control to the end users. I would make sure each user had their own resource file on the network that was used at runtime.
I recently had a client that I had not put RESOURCE=OFF and somehow their foxuser.dbf became corrupt. They were getting the message "Invalid Foxuser.dbf - overwrite with a new empty one?" - however, regardless if they answered yes or no, they were prompted each time they ran the app. The solution: RESOURCE=OFF and delete the stupid foxuser.dbf and fpt files - again, this is a useless "feature" for me these days. -- Randy Jean
Multi-user apps can't see data written from another app on the network and then eventually, it shows up. Right now we use a combination of explicitly opening tables before executing select statements, moving the record pointer in a table and SYS(1104), all sprinkled throughout the code to minimize the impact. Sometimes, we have to turn of NT Caching in the registry. We keep finding new places we have to plug the holes. Some of the fixes create more problems such as SYS(1104) trashing open remote views.
.FRX files latch onto local printer settings, and don't go away when you install it on another machine. You have to hack the file to fix it. see Frx Tips (or something...)
TRANSFORM() with NULL values.

If x is NULL, how would you expect TRANSFORM(x) to evaluate? My guess would have been NULL. After all, if a single term in an expression is NULL, then the whole expression is NULL. But it turns out that TRANSFORM(x) where x is NULL is a character string: ".NULL." -- Mike Lewis

".NULL." is the canonical character form of a null value in VFP just as Transform(1=1) == ".T." Remember, Transform() is turning *anything* into a string, even Transform(CreateObject("Line")) -- Peter Crabtree
Contributors Carl Karsten Randy Jean Bob Archer Mike Lewis
Category Needs Refactoring
( Topic last updated: 2007.03.23 06:48:09 AM )