04.08.2013 Views

Chapter 16 Customizing Your Development ... - dFPUG-Portal

Chapter 16 Customizing Your Development ... - dFPUG-Portal

Chapter 16 Customizing Your Development ... - dFPUG-Portal

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

448 The Fundamentals of Visual FoxPro 6.0<br />

Search Path<br />

The VFP search path is much like the old DOS search path—it’s where VFP will look for files<br />

if they’re not in the current directory. This includes programs, forms, and even databases and<br />

tables! This is particularly handy because, after all, what good are a bunch of cool utilities in<br />

your Developer Utilities directory if you can’t get to them easily? I keep my Developer Utilities<br />

directory in my search path at all times.<br />

Startup Program<br />

Here’s where all the real work happens. You can have Visual FoxPro automatically run a VFP<br />

program when it starts. That’s what the Welcome to Visual FoxPro splash screen really is—just<br />

a VFP program.<br />

But before I get into the details of what your startup program might do, I should mention<br />

that, as with all things FoxPro, there are a bunch of ways to specify the startup program. This<br />

entry in the Tools, Options dialog is one, of course, but you can also make one of two entries in<br />

your config file:<br />

_STARTUP = <br />

COMMAND= <br />

For example:<br />

command = do \MYPROG3.PRG<br />

_startup = "\MYPROG2.PRG"<br />

Note that you need to specify a complete command with COMMAND—not just the name<br />

of a program to execute. If you specify programs in both, both will run: the program attached to<br />

_STARTUP first, and then the one attached to COMMAND. The program assigned to<br />

_STARTUP in your config file updates the value you enter in the Tools, Options dialog.<br />

I personally just use the entry in Tools, Options, and point to my startup program in my<br />

Developer Utilities directory like the rest of the settings I’ve mentioned in this section. So what<br />

could you do in a startup program?<br />

I use mine to launch a couple of applications that I use all the time, add a couple of menu<br />

pads to the standard VFP menu, open a couple of windows, and then place focus on the<br />

Command window when I’m all done. Here’s the code:<br />

* gofoxgo.prg<br />

* start with a good menu<br />

set sysmenu to default<br />

* open the class browser<br />

do (_browser)<br />

* (other programs you want to load can go here too)<br />

* run my custom menu<br />

do GOFOXGO.MPR<br />

* change the title of the VFP window to show what version<br />

* of VFP I’m running as well as the current drive and directory<br />

modify window screen title "We're developing in " ;<br />

+ version() + " (" + sys(5) + sys(2003) + ")"<br />

* open up the Data Session window<br />

set<br />

* place focus back to the Command window

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!