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

Foxpro config 1

Status
Not open for further replies.

bagby

Programmer
Apr 5, 2011
7
US
This has me feeling pretty stupid.

I was a dBaseII programmer from way back in my Apple II days under CP/M. I did Foxpro, and Clipper, but then left xBase for a long time. I've come back to Foxpro for some personal stuff and am re-learning details long forgotten.

My problem's with starting configuration. I've read the MS documentation on the config.pw file, and it's pretty straightforward, or so it says.

(I've also been going through Garfield Hudson's tutorial videos on Visual Foxpro and finding them a great refresher, but he's constantly forgetting to change his default working directory. I remembered that this could be easily done with a config file -- along with lots of other preferences that I used to use long ago.)

So, I've put a "set default to" command into a file named config.fpw, just as the documentation says, but I can't get it to work.

I put that file into the foxpro program directory, where it's ignored.

I copied it into the default working directory, also ignored.

I modified my shortcut to start foxpro with the -C(filename) option, but that's ignored too. All of those are supposed to work according to the docs.

What gives? Am I overlooking something here?
 
SET DEFAULT is a command that will work in the command window or program, not a configuration file item. (See "Special Terms for Configuration Files" in help.)

You can create Windows shortcuts that specify the default working directory ("Start in:"), and you can set the working directory in Foxpro's Tools->Options dialog (click "Set as default" to persist).
 
Ah. That works. Thanks!

I do wish FP would tell me there's a problem in the file, though.
 
It can't really throw an error because that part of VFP hasn't loaded yet at the time config files are read. (This is also why standard commands can't be used.)
 
Now I'm trying to puzzle out TEDIT Having a config.fpw file that says

TEDIT F:\Program Files\Metapad\Metapad.exe

isn't working, nor does any variant of it, so I'm lost again. Is there a short course on the subject of config files somewhere?
 
The help file I previously mentioned is THE short course. (In VFP9, type HELP CONFIG.FPW in the command window.)

If it's a Windows text editor, you need the /n switch:

TEDIT /N (path/file)

But what are you expecting it to do? So few of Foxpro's source files are text files you end up having to get used the the VFP text editor anyway.
 
I remember the dbase built-in editor wasn't too wonderful either, so I preferred programming in, yes, WordStar. (Sneer not, my fingers knew the commands for everything.)

I want to use a programming editor that has a little more language sensitivity, knows when to indent, when to stop, maybe even detects missing brackets and parens (WinEdit used to do this when configured properly.) Something that's a little easier to code in than the built-in.

While I chew on that, I figure that if I can get it to use metapad I can get it to use whatever else I eventually pic.

But adding the /N flag didn't help. Neither did making sure metapad was in the path, and just calling the bare executable. Neither did putting the full pathname in double-quotes in case it didn't like spaces. I tried these things before I asked.

Speaking of the /N flag, there's a good documentation example: to specify a Windows text editor -- Well, as opposed to what, exactly? edlin?

Anyway, I can't get it to work, but it doesn't seem like it ought to be difficult at all.
 
/N is "as opposed to" Wordstar. (Yeah, some people still do.)

I haven't fought the editor fight since Foxpro 2.0, when I finally gave up on Sidekick (those same WordStar keystrokes) and went with the flow.

If you're using VFP9 (and you should be) you might want to give the native editor and intellisense a whirl before you waste a ton of time trying to get something else to work. Just a thought.
 
I think the editor must accept the filename to edit as an argument. Try TEDIT /N notepad.exe, to demonstrate it's working.

The internal editor may not be the best, but you can hook in into editor events. Search Christof Lange's isx.prg for examples.

You can also extend possibilites via keyboard makros and intellisense manager.

In regard to parens for example, the vfp9 editor will highlight the complete section back to the opening bracket, when you write a closing bracket.

Bye, Olaf.
 
Bagby,

First of all, welcome to the forum, and to Visual FoxPro. Nice to meet another ex-dBASE II person.

Looking back at your original point about SET DEFAULT. I don't think anyone has mentioned that you can include all the SET settings in your config file, but the syntax is slightly different.

In general, instead of saying:

SET XXX TO YYY

you just say:

XXXX = YYY

So, for example:

DATE = BRITISH
BELL = OFF
DEFAULT = c:\progs

Regarding TEDIT, although this is still supported, it's not really necessary these days. Under Windows, you can simply switch to a different editor, edit your code, save it, switch back to VFP, and run it.

VFP uses the date stamp to decide whether to compile the program. VFP doesn't have to know that the editing was done externally.

TEDIT was obviously more important before we had task-switching. You mentioned WordStar. My editor of choice was Sidekick. I could just pop it up on top of dBASE or Foxbase, do the editing, and then immediately run a test.

Hope this helps.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Olaf, that's actually the first thing I tried.

I'm also new to Win7, having finally switched over last month from XP because I got a system that could. (May still go back to XP, mutter, mutter.)

But using Notepad didn't work, whereupon I figured maybe there's something different about Win7, so thought I would try getting metapad to work (because it's self=contained in a single file, and works "from anywhere" if it's in the path. (I didn't know if those things were still true of Notepad in Win7)

Dan, the new things are kinda piling up here. I did want a familiar environment with no surprises or mysteries while I debug my sloppy code. I do intend to get into the Foxpro editor further, I'd just rather not do that right now.

And, after all, it's *easy* to specify a different editor in your config file. Yeah.

Mike, thanks for the welcome and the tip!
 
The editor doesn't actually come into play when you're debugging, to be honest. That's done in the debugger. (d'oh)

The external editor isn't used on anything created in the form designer, class designer, or menu designer, and that's about 90% (or more) of a VFP application.

This is the first time you've mentioned Win7. I'm wondering if the increased security might be keeping VFP from launching an external exe? Hmmm... no, I can't get it to work at all, even running as Administrator. Do you begin to see how seldom this feature is used? <g>
 
I rarely build applications, so I'm basically just dealing with scripts -- the prg files themselves. When an error occurs, the .prg file pops up in the vfoxpro text editor. I'd like to change that to my editor-of-choice.

This is the way I'm accustomed to work for Q&D data manipulation one-off, like my personal movie collection of 400 uncatalogued disks.

Well, regardless. That's how the help-file says to do it, and it doesn't work. Apparently this isn't something I'm doing wrong, it just doesn't work.
 
Last time I used it was in VFP7. That feature might really be deprecated without further notice. I'll see if it's an OS issue, but I trust dan on running vfp as admin also didn't work.

There's still isx.prg, using foxtools undocumented editor functions. Well, they are described in the FoxPro 2.5 Library Construction Kit, a set of functions starting with _ED and _W.

Here's an important example:
Create a hotkey via ON KEY LABEL, like christof does in isx.prg, then call a function determining _EDGETENV, then you have the file name edited and can execute your editor of choice to edit this same file. That would mean only one hot key needed to edit the code of the current editor window in another editor instead.

Bye, Olaf.
 
Give the VFP editor with IntelliSense a chance. It'll help you a lot.

Tamar
 
I agree with Tamar, but I noticed this morning that some other testing had left some settings in place that messed with my earlier experiments. This syntax in config.fpw works just fine:

tedit=/n notepad.exe

(note the =)

RUNAS Administrator isn't necessary.

BUT, it takes some pretty careful handling to make sure you're using (and editing) the *right* config.fpw and not some virtualized version thought to be saved in the VFP directory but actually saved in the user's virtualization folder.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top