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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Paths probelms at design time

Status
Not open for further replies.

Donquick

Programmer
Aug 13, 2007
14
GB
Hi all,

I am just starting out on this path of VFP. I know the language from old but not the interface.

I am getting very frustrated with assigning paths during designtime of my first project.

I create a project and I want to test the various elements of the project as i go along rathert hen generating an app and running that all the time. I presume this is all common practice.

What is the suggested method for getting vfp to look in the right place for files? It creates this directory structure with the PROGS, FORMS, REPORTS, LIBS,.. but then insists on full paths for every blessed file call within a program!

At the moment i have a prg file in the vfp9 directory deep in my program files area in which i have a a number of set default to.... and set path to ... statements

So each time i strt foxpro i run this file and then i am ok most of the time. However, if i then just say, for example, 'open database XYZ' in some code I get 'C:\XYZ\XYZ.dbf does not exist. The file is in the \DATA subdirectory but it doesn't look there.

What is the accepted method for getting prepared for designtime coding with paths etc after creating a new project. There must be a better way - help, please.

Thanks,

 
Hi Magnus,

I'll tell you how I handle this issue. Other people might have equally valid ideas.

1. I create a root directory for my project. Let's say it's called c:\fox. Place your main program in this directory (definitely not in the VFP9 directory, as you are doing).

2. Within this directory, create sub-directories for your various components. Call them Forms, Reports, Classes, Code or whatever.

3. In Tools / Options / File Locations, set Search Path to the following: Forms, Reports, Classes, Code etc (obviously using whichever directory names you created in the previous step). NOTE: These are relative paths only. You do not enter c:\fox\forms, etc.

4. If you close Tools / Options and then open it again, you will see that VFP has changed the directories to include the full path (perhaps c:\program files\vfp9\forms, etc, or something similar). Don't worry about this. Just ignore it.

5. Now, whenever you're ready to start a programming session, go the command window and type CD c:\fox. (In fact, with Intellisense enabled, you only have to type CD and a space, then pick the directory from the list.)

6. All your paths will now be correctly set. You can edit or run any component just by referring to its name, not its full path.

You certainly don't have to build the app in order to test a single component. However, since you probably have classes that depend on each other, including perhaps some that have to be instantiated globally, it probably makes sense to run the entire application each time. (Run it, but don't build it.) To do so, just DO Main (or whatever the main prog is called). Do that from the command window.

I hope this makes sense. This is the approach I have used since I started with VFP, and have never had any reason to vary it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hi Mike,

Great answer, very clear and understandable.

Thank you very much indeed, I will have a few less headaches and frustrations now. It's these housekeeping issues which makes the learning curve so steep isn't it? With VFP so far i have done about 10% coding and 90% trawling through help files trying to get everything setup and working.

Thanks again.

Magnus

 
Thanks Andy - that makes very interesting reading.

Cheers,

Magnus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top