Good Afternoon Christof:
Wow!
a) I don't think applies because I only use the VFP editor to manipulate the 
code
b) I have not noticed any files crashing when the form is saved and have not 
noticed any formname.tmp files in the project folder
c) Very interesting. So what you are saying is that any VFP file that has code 
should be excluded from the virus scanner. These files would include scx, sct, 
prg, frx, frt, frx, vct, and vcx
d) I have never seen an object disappear but obviously the code disappears from 
the object's event and complete method code disappear but not the method name
e) I guess this would explain Dave's solution to the missing code; the compile 
command rebuilds the objcode from the methods field. But I guess it does not 
explain why the 2 fields are out of sync when I compile the project into an exe 
when the checkbox for 'Compile all files' is checked.
Also, as a carry over from other versions of dBase, foxbase, FoxPro DOS, FoxPro 
Windows and now VFP I use  ctrl W to save the changes and exit the 
form/report/prg. What is your opinion of this?
So let me ask the question...what is your procedure to save any file that has 
code associated with it?
Thanks for a tremendous insight to the situation.
Best regards,

Jack Skelley

Jack Skelley
Senior Director, Programming/Computer Operations
New Jersey Devils
(973)757-6164
jskel...@newjerseydevils.com ________________________________________
From: profoxtech-boun...@leafe.com [profoxtech-boun...@leafe.com] on behalf of 
Christof Wollenhaupt [christof.wollenha...@foxpert.com]
Sent: Monday, March 26, 2012 10:54 AM
To: profoxt...@leafe.com
Subject: Re: VFP9: Method Code Disappearing...

Reasons for code disappearing in a form method:

a) pre-processor command mismatch
b) saving the form
c) virus scanners
d) object memory corruption
e) object code corruption

a) Code for an object is stored in a single memo field, one record for
every object added to the form. When you save a method in the method code
editor, VFP performs a validation on the structure of the code. If you
ignore warnings or when code is manipulated outside the editor, you might
end up with code where an #ENDIF line is missing. When VFP compiles the
code this will remove all procedures until the next #ENDIF in any of the
following procedures or the end of the memo file.

b) The process of saving a form is as follows: Renaming the original file,
saving the form under the old name, deleting the copy. Unfortunately, VFP
does not verify if the form was saved correctly and might delete the backup
file even when the form was saved incorrectly. This is, for instance, the
case when there's a write lock on the SCT file while it is opened in an
external program (mostly a viewer or a virus scanner). When VFP crashes
while saving a form, you should search for a TMP file created around that
time. It's the previous copy of the SCT file.

c) The SCT extension is also used for scripts. As such, many virus scanners
either block this extension or perform extra checks. If you experience
issues with SCX files but not with VCX files, then excluding SCT files from
the virus scan might fix the issue.

d) Under some circumstances VFP keeps references to classes in memory. In
most cases you either see a "Cannot modify class in use" error message or a
prompt to clear the class from memory. Sometimes this doesn't happen
though. In these cases one of two things might happen:

1) Any object based on this class is removed from the form. Saving the SCX
file will not only permanently delete any code associated with the object
but also the object itself. As SCXes are always recreated, you can't
undelete older records as you sometimes can do with VCX files.

2) If the class in question is edited, you may be able to modify the class,
but all methods are empty.

e) The source code is in one memo field, the compiled code in another. The
OBJCODE field contains the pointers which line belongs to which method. VFP
uses these pointers whenever code is loaded into memory in the form
designer. VFP creates these pointers only when compiling the code. When the
OBJCODE field is empty, opening the form will not show any code. Saving the
form will erase code, as the METHODS field is generated based on the code
loaded previously. If the OBJCODE field is out of sync, methods will be
splitted arbitrarily with ENDPROCs being in the middle of a code window or
random binary characters appearing anywhere in the code. To fix OBJCODE
issues you need to recompile the form with the COMPILE FORM command.

Christof

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/7d9e7f72b813014c8fd022cf04f820ed139...@ex08.drdad.thenewarkarena.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to