Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Program error in hook code
Message
De
09/10/2008 03:41:49
 
 
À
09/10/2008 03:29:20
Lutz Scheffler (En ligne)
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de projet
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2008 Server
Database:
Visual FoxPro
Divers
Thread ID:
01352927
Message ID:
01353755
Vues:
24
Hi,

My point was that, in my code, the problem was not with the FOREACH (or even,AFAICS, with the project object itself) - only with the .FILES collection - the debugger was showing it as 'could not be evaluated' but with a .Count of zero. Given that I don't think a for loop would have worked either.

Regards,
Viv

>Look at the last three lines of example, I copied the whole block to not modiefy to much ...
>
>Agnes
>>Hi,
>>
>>THanks, but whilst your code may be safer mine *had* ,in this case, safely identified the correct/valid loProject object. It was the reference to loProject.Files that was failing....
>>
>>Regards,
>>Viv
>>
>>>I do not trust For each in VFP8
>>>
>>>I use
>>>
>>>*Get Link to this hook (THIS does not respond, must not be active since controled by code)
>>>*TAG is  THIS.TAG = SYS(2015) in Init event
>>>FOR lnLoop2 = 1 TO _VFP.PROJECTS.COUNT
>>> IF TYPE('_VFP.Projects(lnLoop2).PROJECTHOOK')='O';
>>>   AND !ISNULL(_VFP.PROJECTS(lnLoop2).PROJECTHOOK);
>>>   AND _VFP.PROJECTS(lnLoop2).PROJECTHOOK.TAG=THIS.TAG THEN
>>>  loProject = _VFP.PROJECTS(lnLoop2)
>>>  EXIT
>>> ENDIF &&TYPE('_VFP.Projects(lnLoop2) ...
>>>ENDFOR &&lnLoop2
>>>
>>>FOR lnFile = 1 TO loProject.FILES.COUNT
>>> loFile = loProject.FILES(lnFile)
>>>  ...
>>>
>>>
>>>for this problem.
>>>
>>>HTH
>>>
>>>Agnes
>>>>>>In the INIT of a project hook I have:
FOR EACH loFile IN APPLICATION.ACTIVEPROJECT.FILES
which has been working for years. Now I get a 'Property FILES not found' error on this line. The debugger shows Application.Project appears to be the valid and correct project; .FILES is an object but .FILES.Count gives 'Expression could not be evaluated'. This isn't project specific - I get the identical error in another project. Also, at least AFAICS, there's no #INCLUDE that could mess this up and if I step out of the code the project opens normally with all files listed.
>>>>>
>>>>>I am not sure about this issue either as I have never hit it and I use project hooks all the time. One thing to try is to clean the project up via the Project | Clean Up Project option. It might be a problem with a corrupt record in the project.
>>>>
>>>>Hi,
>>>>Didn't appear to be a problem with the project files either. After I'd reinstalled VFP the same project/hook ran perfectly.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform