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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

464 The Fundamentals of Visual FoxPro 6.0<br />

Developer utilities<br />

I’m of two minds while writing this section. One part of me wants to share a bunch of cool<br />

utilities that I think you’ll find useful. The other part of me knows you all too well—and I know<br />

you’re thinking, “Building my own utilities is half the fun of being a developer!” So I’m going<br />

to take the middle road and list a few simple tools I’ve found handy, and then describe a few<br />

more that you might want to build yourself.<br />

I’ve divided this section into two pieces: those that I wrote myself, and those that I found<br />

elsewhere.<br />

My own stuff<br />

Part of the thrill of being a developer is writing your own utilities in response to needs<br />

that come up during your day-to-day coding. Here are a couple of mine and Doug’s.<br />

They’re included with the source code files for this book at www.hentzenwerke.com.<br />

WW<br />

I’m forever using a Wait window or a message box to quickly display the value of some<br />

memory variable or contents of a field. The problem is that you need to convert the value to a<br />

string in order for it to display properly—and, if that’s not hard enough to type, you don’t<br />

always know what the data type of the value is. (By doing this in the first place, you already<br />

demonstrate that you don’t know what the value is—it’s likely that you don’t even know what<br />

the data type of the value is, right?)<br />

This little function—only two characters long—takes any type of data and displays both<br />

the type of data and the value itself in a Wait Window box in the center of the screen. You can<br />

pass a “,1” parameter to WW to display the value in the upper right corner of the screen, where<br />

Wait Window displays by default, or a “,2” parameter to display the value in the upper left<br />

corner:<br />

m.lcX = "FJFJFJFJFJFJFJFJFJFJ"<br />

? ww(m.lcx,2)<br />

The parameters correspond to the quadrant numbers you learned about in high school<br />

geometry. See Figure <strong>16</strong>.8.<br />

Figure <strong>16</strong>.8. “WW” will produce a Wait window<br />

that displays the data type and value of any<br />

variable or field name passed to it.

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

Saved successfully!

Ooh no, something went wrong!