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!

Selecting VCX Is Not Remembered

Status
Not open for further replies.

stanlyn

Programmer
Sep 3, 2003
945
US
Hi,

I have a form that relies on a custom .vcx file. Each and every time I open the form, I am prompted for the location of the vcx. I navigate to it and all is OK until I close and reopen the form, and I have to once again point it to the vcx location.

Generally, once you point it to the location, it should never re-prompt.

The folder where the vcx is located IS in the path, but it still prompts for it. It even prompts when running as an app with the SET CLASSLIB TO 'SlaBaseObjects.vcx'
in the main.prg when calling the form. If I run it as an .exe, it works as expected.

Any ideas on troubleshooting?

Thanks,
Stanley
 
Hi,
You may want to check under Tools - Options - File Locations - Search Path if all the paths to be searched are listed, They are separated by semi-colons (;)
hth
MK
 
Simply save the form after having picked the VCX: CTRL+S
To ensure the form really is saved updated you may add a space to any method in code section, too.

To explain: If you normally work on a form after having made that manual fix the saving happens anyway, but the form designer/class designer does not automatically save your picked VCX, so your experience is based on occasions you not only picked the vcx but also changed anything else, fixed a bug or added some feature. Picking a clss/vcx is only remembered in the current session if you don't save. That's a minor bug in the form/class designers.

That also means the designers don't care for your PATH setting, they only look into the location of classes and controls within the SCX/VCX data classloc field and you only fix that with saving, not merely with picking the correct vcx. At runtime the classloc is secondary, as the EXE always is searched first, that also explains why it's only a problem within the IDE.

Bye, Olaf.
 

Opening a form, and selecting the correct vcx while opening, then double click a command button, then add a space and press enter to the end of a line. Then Ctrl-S to save. Also done File-Save to save it via the gui.

If I close the form and project and reopen it and load the same saved form, it prompts me again for the vcx location. Then do it all over again. (not remembered)

Now, if I only close and reopen the form for editing (not the project), it is remembered and does not prompt for its location.

To get it to work, I added the vcx folder to the projects search path and set as default. That does worked, and this is the only time I've had to explicitly add anything to the search path. Usually I add the vcxes, forms, programs and etc to the project and all is good. Adding it to the project just doesn't work.

Thanks,
Stanley
 
Are the classes you're using child classes themselves? If so, open them up in the VCX they come from and you'll likely find a broken classloc there. That's not fixable within the form or form class, that's only fixable within that controls VCX.

Bye, Olaf.
 
Hi Olaf,

Olaf said:
Are the classes you're using child classes themselves?

No, it does not rely on anything other than base classes. This is happening to only one class that has been working for 10+ years. No issue with the other classes.

Thanks,
Stanley

 
Hi stynlan,

There must be something flaky with classlocs, so please lets see what a full automatic analysis gives you. Add this prg to your pjx and run it from the project manager:
Code:
Local loFile

Clear
Set Exact Off

For Each loFile In _vfp.ActiveProject.Files
   If Adir(laDummy, loFile.Name) = 0
      * The project manager only checks these paths when you modi pjx
      ? "Error, project file not found:", loFile.Name
      Loop
   Endif

   * Matter of taste: All project files should be within the PJX home folder
   If Not (loFile.Name = Justpath(_vfp.ActiveProject.Name))
      ? "Warning, file not within PJX home folder:", loFile.Name
   Endif

   If loFile.Type $ "VK"
      Use (loFile.Name) In Select("curclasslib") Alias curclasslib
      Select curclasslib
      Scan For !Empty(curclasslib.classloc)
         If Right(Left(curclasslib.classloc,2),1)=":"
            * referencing a class with absolute path means a non moavable dependency
            * again all paths rather should be relative to each other
            ? "Warning, absolute path classloc:",loFile.Name, curclasslib.Class, curclasslib.classloc
            If Adir(laDummy,Alltrim(curclasslib.classloc))=0
               * absolute classloc not found
               ? "Error, non existant classloc:",loFile.Name, curclasslib.Class, curclasslib.classloc
            Endif
            Loop
         Endif
         If Adir(laDummy,Addbs(Justpath(loFile.Name))+Alltrim(curclasslib.classloc))=0
            * relative classloc not found, means you probably copied libraries without also copying parent class libs
            ? "Error, non existant classloc:",loFile.Name, curclasslib.Class, curclasslib.classloc
         Endif
      Endscan
   Endif
Endfor
If there is no output from this paths check routine everything is in place.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top