Wiki Home

Command Window


Namespace: Wiki
For many developers, the Visual Foxpro Command Window is what separates Visual FoxPro from the rest.
Some points about the Command Window
  • If it's not visible, you can invoke the command window with Tools - Command Window from the menu or, my favorite, use ctrl+f2.
  • The command window has its own set of properties, available through rightclick - properties.
  • Note that you can clear the command window with rightclick - clear.
  • Like in any other code window, you can highlight a block of code and hit rightclick - execute selection. Note that this isn't line-by-line execution, rather the block is compiled into a temporary program. Thus you can even include structured code, etc. Further, you can get errors that would not have occurred with lines executed directly. Note the related gotcha that variables defined in the highlighted block of code are not available when it is done executing.
  • Unlike other code windows, you can highlight a block of code and hit Enter to execute the code. You don't even have to highlight single lines--just cursor to it and hit Enter. This works the same as highlight - right click - execute selection as to being a separate block. This is so even if the block is only one line!
  • If you type a line of code but don't want to execute it yet, CTRL-Enter allows you to end the line anyway.
  • You can change font in the command window independently of fonts in other edit modes.
  • Novices may be pleased to realize that you can reexecute a command window statement by placing the cursor upon the statement in the command window history stack and hitting enter. You can also edit historical statements and execute those. Sure beats typing it all again.
  • Historical statements persist between sessions of VFP. When you start work in the morning you can see the last commands you used last night. It's especially useful on a Monday morning if you've spent the weekend on another planet.
  • The editor's Find command works in the Command Window. Press CTRL+Home to go to the top then CTRL+F to find something.
  • The editor's Replace command also works in the Command Window but I can't think of a good use for it.
    Does anybody know where in the registry the command window properties are kept?
    They are not in the registry. They are kept in the RESOURCE table (i.e. FOXUSER.DBF).
    Not to put too fine a point on it, the VFP Command Window kicks ass.-- Steven Black

    I agree, but I still would like to be able to direct output (i.e. "?" stuff) to the command window instead of the main VFP window or the active form. It's pretty cool how the "Immediate Window" works that way in ACCESS and VB. Alternately, it would be nice to be able to scroll and highlight/copy from the screen.

    I can see how, coming from a VB perspective, sending output directly to the Command Window is desirable, but a way to get something similar is to use ON KEY ... KEYBOARD This is almost as good to get long expressions into the command window to be modified and re-used. (ie: type ON KEY CTRL+A KEYBOARD filter() in the command window and hit enter, then type SET FILTER TO and press Ctrl+A and then modify the result by hand). -- wgcs
    The command window also echoes all commands generated by the foxpro menu system and by interaction with a foxpro project to the command window making them easy to duplicate--? anyone recall how to restore the default echo-to-command-window functionality? I've made a couple of attempts digging through the help file and option settings, but cannot find anything. A search for "echoed in the command window" in the VFP help file brings up multiple references, but nothing telling one how to restore this default behavior. I seem to recall it having something to do with "SET HISTORY" or "SET DEVELOPMENT" (VFP7 soon to be 9).

    Brett Carraway

    Contributors: Original ?, Updates by Randy Pearson Steven Black wgcs
    Category VFP IDE Category Learning VFP
  • ( Topic last updated: 2006.07.11 10:46:08 AM )