(Because HackFox is structured a bit differently than other books, this table of contents lists each major section plus the first paragraph or two in each section.)
Section 1: Wow, What a Concept!
Section 1 introduces the major themes of Visual FoxPro, starting with its history and covering the fundamentals of each of its major sub-languages. Think of it as the "If it's Tuesday, this must be Belgium" Tour of Visual FoxPro.
"It's Always Been That Way"
"In the beginning"—isn't that how histories normally begin? But what is the beginning of Visual FoxPro? It has bits and pieces from so many different languages and technologies that there's no one beginning. Visual FoxPro is a true hybrid.
One bit of lineage is clearer than the rest, though, and that is FoxPro's Xbase heritage. For that, there's at least a partial beginning. "In the beginning, there was the dot."
DBF, FPT, CDX, DBC—Hike!
The transition from the FoxPro 2.x model of the universe to the Visual FoxPro mindset was pretty revolutionary on a lot of fronts. While we cringe to use the hackneyed and overused term, the introduction of databases in Visual FoxPro was a major paradigm shift and one that took some getting used to. The introduction of the database container, local and remote views, vast improvements in client-server connectivity, and a slew of new data types, commands, and functions was mind-boggling. We'll try to give you an overview of the data changes here, and refer you to areas where you can get more information throughout the book.
If you're coming from an Xbase background, you might think you're encountering some NewSpeak in Visual FoxPro, but it's all for a good cause. Individual DBF files used to be referred to as "databases" but now, a better term, that used by Visual FoxPro, is to call individual DBF files "tables" and the new DBC a "database container" or just "database" for short. While it's frustrating to try to change terminology you've been using for years, we've found it does lead to greater understanding of the new scheme of Visual FoxPro. Not only that, but the new names bring us in line with the rest of the relational database world.
FoxPro's oldest heritage is its Xbase heritage. As we said in "It's Always Been That Way," Xbase has a long and varied history. This section explains the basic language concepts that derive from that history.
dBase was originally conceived primarily as an interactive language. Because of this, many of the older commands' default behaviors focus on interactive results, with optional clauses available to use the command programmatically.
SQL, which stands for Structured Query Language, is a set-based language. Unlike Xbase, which cares about individual records, SQL is interested mostly in groups of records. (The Xbase concept most similar to SQL's point of view is the FOR clause.) The name "SQL" is read by some folks as a series of letters ("ess queue ell") and by others as "sequel"—we use either one, depending on the phase of the moon, though we lean more toward the latter these days.
OOP is Not an Accident
We've heard about Object-Oriented Programming (OOP) for more than 20 years. At first, it was just theory. Then, we started hearing about this language called SmallTalk. In the last few years, OOP's been everywhere, and the claims of who has it and how it revolutionizes programming have grown louder and louder.
So what is OOP? Why is it important? And has it really changed the way we program?
Controls and KAOS
Controls are the means of interacting with users. Some, like the text box and the command button, are visual elements of the user interface; others, like the timer and the session controls, don't have a visual element, but work behind the scenes to support the user interface. Understanding the intricate ways in which the properties, events and methods are evaluated and executed is essential to grasping how Visual FoxPro works. In this section, we'll discuss what controls are and some of the features common to controls. We'll go on to look briefly at each control (you'll find more in the Reference section), and discuss where it's appropriately used. At the end of the discussion, we'll explain how the built-in characteristics of controls can be extended to create more complex and customized controls, tailored to meet your clients' needs, capable of interacting with your users in ways beyond those anticipated by Visual FoxPro's designers.
A Gala Event
What is an event? What do we need to do about it? The FoxPro family was a leader in the Xbase world in moving from a procedural application to an event-driven interface, even in DOS. With Visual FoxPro, FoxPro became fully attuned to the rich event model of the underlying Windows interface. Visual FoxPro can create far more responsive applications, and applications that are more consistent with the behaviors of other Windows programs. We'll examine the different events that are possible, under what circumstances they occur, and what code is appropriate for each of them.
"Your Server Will Be With You in a Moment"
Client-Server: definitely one of the buzzwords of the nineties. Or is that two of the buzzwords—we haven't figured out yet whether "client-server" is one word or two. We're not alone in this. A salesman for a major vendor asked to define client-server a few years ago responded, "Client-server? Why, that's whatever it is I'm selling today."
So why all the fuss about client-server? Because most organizations have their data spread out over multiple machines in at least as many formats. Client-server is advertised as the ticket to using all that data without forcing everyone to use the same applications or having to convert everything to a common format.
Of course, now that we're in the zeros (or is that the aughts?), client-server should be passé, right? Well, although it certainly gets less attention than it did when we wrote earlier editions of this book, client-server still has a lot of life left in it.
"It was Automation, You Know"
Have you ever been working in one application and really needed some capability from another? Say you were creating a report in FoxPro, but really needed Word's formatting prowess? Or maybe you needed to do calculations on a few items of data contained in a set of spreadsheets? We sure have, more times than we can count.
"Ah, What a Tangled Web We Weave"
The Internet. Unless you've been hiding in a cave for most of the past decade, you know that the Internet, and particularly the World Wide Web, has captured the lion's share of the publicity in the computer world. What is it about the Web that has attracted so much attention? What can we FoxPro developers do to capture some portion of this market? And what should we do?
This is not a primer on the technologies of the Internet—there are many fine books on that subject. Nor is it an in-depth examination of the techniques needed to assemble a robust VFP Web-based application—that's well covered in other volumes in the Essentials series, which includes the fine volume you're reading now. Check out Rick Strahl's awesome Internet Applications with Visual FoxPro 6.0, and also WebRAD: Building Database Websites with Visual FoxPro and Web Connection, by Harold Chattaway, Randy Pearson, and Whil Hentzen, both available from Hentzenwerke Publishing. Our goal is to give you a brief overview of the stuff that's involved, and then we'll dig into the stuff you can do with Visual FoxPro.
Section 2: Ship of Tools
Section 2 discusses in brief the Power Tools—the key to using Visual FoxPro effectively. You'll find our favorite tips and tricks for using the Power Tools here, too, and an introduction to integrating source control with VFP development.
When Should You Use the Power Tools?
We used to say (and believe) "always" as the answer to "W