Scrigroup - Documente si articole


HomeDocumenteUploadResurseAlte limbi doc
AccessAdobe photoshopAlgoritmiAutocadBaze de dateCC sharp
CalculatoareCorel drawDot netExcelFox proFrontpageHardware
HtmlInternetJavaLinuxMatlabMs dosPascal
PhpPower pointRetele calculatoareSqlTutorialsWebdesignWindows

AspAutocadCDot netExcelFox proHtmlJava
LinuxMathcadPhotoshopPhpSqlVisual studioWindowsXml

Working with Visual FoxPro interactively

Fox pro

+ Font mai mare | - Font mai mic

Working with Visual FoxPro interactively

Everything I'll discuss in this chapter can be tried using the Command window-and I urge you to open VFP and play along. First, I'll explain how to use the Command window interactively.

Using the Command window

You use the Command window to enter commands in order to perform some sort of action. In this, it's similar to a command-line interface-the DOS prompt (er, in NT, it's the "Command Prompt") comes to mind. However, you can also use the Command window to test expressions, and it's here where we'll start.

By the way, if you accidentally close the Command window, you don't have to exit VFP and start it up again-just open it using the Window, Command Window command, or by pressing Ctrl+F2. In fact, keep the keystroke combination Ctrl+F2 in mind-if the Command window is open but it's not the active window on the desktop, Ctrl+F2 will make it the active window. I do this all the time when I'm typing in a program file and want to switch to the Command window without lifting my hands from the keyboard to grab the mouse.

To execute a command or expression, type it into the Command window and press Enter. The Command window is not case sensitive, so you can use either uppercase or lowercase, or a combination of both. For example, typing "dir" in the Command window and pressing Enter will cause a list of files with the extension "DBF" to be displayed on the main FoxPro desktop. See Figure 2.1.

Another example is issuing a command to run a program. For example, typing "help" and pressing Enter will bring forward the Visual Studio MSDN Library help window. See Figure 2.2. In this particular case, it's actually a separate application (you can see a new icon in the taskbar and the task-switching window).

Both "DIR" and "HELP" are commands-they tell VFP to do something. However, you can work with functions and expressions in the Command window as well. The "?" command, in concert with an expression, echoes the result of that expression to the VFP desktop. For example, entering the command:

? upper('a lower case string')

into the Command window and pressing Enter will display the result of the UPPER() function being applied to the text string "a lower case string". See Figure 2.3. (In between each of these screen shots, I used the CLEAR command to clear the VFP desktop of the results of the commands I've executed.)

The Command window context menu

If you've been following along and entering these commands yourself, you'll see that all of the commands you've entered will be visible in the Command window. By default, the Command window retains all of the previously entered commands, which is incredibly handy. To execute a command again, all you have to do is move your cursor to a previous command and press Enter. Furthermore, you can edit that command and execute the modified version just by pressing Enter. I remember the old days when you had to type a long command in by hand each time-quite a nuisance when the only difference between the two commands was the name of a field or a missing comma.

The Fundamentals of Visual FoxPro 6.0

However, if you look at each of the preceding screen shots, you'll notice that the Command window displays only the current command. How'd I do that? One possible explanation is that I brushed up the screen shot in some image-editing program. Another explanation is that I quit VFP and started it again so that the Command window would be empty, and for years that's what presenters had to do if they wanted to have a virgin window when they started their presentations. However, in VFP 5.0 and later, a context menu was added to the Command window. If you right-click while your mouse is in the Command window, a menu will appear. You can use the Clear menu option to empty the Command window, and that's what I did in order to present cleaner screen shots for this book.

If you examine the other menu options in the Command window context menu, you'll see the standard Cut, Copy, and Paste functions, just as you would expect in any type of text or editing window. Click the Build Expression menu option to open a dialog that allows you to build VFP expressions by picking and choosing from lists of functions and operators.

The Expression Builder dialog box opened from the Command window

context menu is by default the native Visual FoxPro expression builder. You can use your own expression builder instead-the details are explained in Chapter 16, "Customizing Your Development Environment."

The Execute Selection menu option allows you to highlight a block of text in the Command window and execute it, all in one step. This is handy for executing several commands at once; before this functionality was available, you'd have to (1) open up an empty program file window, (2) copy the series of commands into that window, (3) save that file, and (4) run it. This was about three steps too many for most people. Furthermore, you ended up with a ton of files in the current directory with names like XXX.PRG, DELETEME.PRG, and JUNK.PRG.

The last option in the Command window context menu is Properties; selecting it opens a dialog that allows you to set various properties of the Command window. Many of the controls in the Edit Properties window are disabled for the Command window because this same dialog

is used for program file and text file windows as well, and the options don't apply to the
Command window.

The drag-and-drop editing feature is one that I've overlooked until recently. When this feature is enabled, you can highlight a block of text, right-click in the middle of the highlighted block, and then drag a copy of that block to another location-either in the Command window or to another window altogether. My Ctrl+C and Ctrl+V key combinations see considerably less wear these days.

You aren't limited to dragging within Visual FoxPro anymore. As I was writing

this chapter, I didn't cut and paste (or, <gasp>, retype!) any code. Instead, I dragged code snippets from VFP into Word. This capability is called OLE Drag and Drop, and is new to VFP 6.

Politica de confidentialitate | Termeni si conditii de utilizare



Vizualizari: 967
Importanta: rank

Comenteaza documentul:

Te rugam sa te autentifici sau sa iti faci cont pentru a putea comenta

Creaza cont nou

Termeni si conditii de utilizare | Contact
© SCRIGROUP 2024 . All rights reserved