====================================== FoxPro Developers Network of San Diego ====================================== FoxDev TipsLetter #00-09 September 2, 2000 Website: Editor: ---------------------------------------------------------------------- CONTENTS: * Calendar * Tech Tips: Positioning Added Objects Steve Settimi How Wide Is Your Arial Dan Covill Re-Creating Local Views Steve Settimi Where Do I Find...? * Other Stuff: Microsoft Training in San Diego Thad V'Soske Software Engineering Course "Eric" Microsoft SoCal Calendar Nick Nikula VFP6 Available At Discount Dan Covill Another Day Done Gene Wirchenko So Much For WYSIWYG Stephen Pemberton Windows Source Code anonymous Consulting Solutions Group IS NOW Alitum * Administrivia ====================================================================== CALENDAR: We alternate meetings between Escondido and Sorrento Mesa. All meetings are at 7:00 pm. Note: We are still meeting at the same location in Sorrento Mesa that we have been. Sept 6 - Escondido ------------------ Board member Barbara Peisch will be talking about using Steven Black's INTL toolkit for creating multi-lingual apps, with a special emphasis on his Message Service. Oct 4 - Sorrento Mesa --------------------- Duke Lotherington and Peter Stephens will be showing a product they have developed called Visual Record. This product is a vertical market application geared toward medical records keeping. Nov 1 - Escondido ----------------- Board member Art Bergquist will show us how to use dynamic controls in a grid. Dec ??? --------------- Our annual holiday dinner party. The date and location are still TBD. This traditional get together is a great chance to hob nob with other members, and dinner is free for all paid members! Escondido meetings are at Bergelectric, 2222 Meyers Avenue. Take the Nordahl exit from Highway 78 (west of I-15). Head South. Right on Meyers Ave, first right past Mission. It's a one-story building on the right (there's no sign). Sorrento Mesa meetings are in the PS Business Center, 6450 Lusk Blvd. From the Lusk Blvd driveway, go straight back to the furthest corner of the rear bldg and park. The conference room is upstairs over the Fitness Center. ====================================================================== TIPS ====================================================================== POSITIONING ADDED OBJECTS by Stephen Settimi Here's an easy way to visually pre-position objects that will be added to a form using the AddObject() or NewObject() functions On your form draw shapes where you want the objects to be placed. These will serve as placeholders. Make each one invisible. You can select all the objects by holding down the Shift Key and clicking each one (or select all from Edit Menu and de-select all but the shapes you've drawn) . In the property sheet set the Visible property to .F. For easy referencing, name the shapes "shp" plus the name of the object you will be adding (ie., shpMyGrid, or shpMyPageFrame; shpMyImage). Now in the event or method procedure in which you will be adding these objects make a call to add the obect (i.e., Thisform.NewObject('MyGrid','myGrid','MyLibrary.vcx') Note: In using NewObject(), designating the library extension of "VCX" is optional for vcx's but not for .EXE, .APP or .FXP types when class definitions are found in those types of files, so it's a good practice to use the extension in any respect. After the object is instantiated but before making it visible, position the object by referring to your spaceholder (the invisible shapes) Feel free to macro substitute string expressions to your heart's content! With thisform .MyGrid.Top = .shpMyGrid.Top .MyGrid.Height = .shpMyGrid.Height .MyGrid.Width = .shpMyGrid.Width .MyGrid.Left = .shpMyGrid.Left .MyGrid.Visible=.t. Endwith ---------------------------------------------------------------------- HOW WIDE IS YOUR ARIAL? by Dan Covill The VFP FontMetric() function is the standard way to calculate the proper width for a control using proportional fonts. this.Width = len("FieldName") * FontMetric(6, "Arial", 9) FontMetric(6, ...) is the average character width, and 7 is the maximum character width. You will soon find that if your fields contain upper-case, FontMetric(6) is way too narrow, so you end up using FontMetric(7). Well, guess what, folks? In the finest tradition of Windows and VFP, there's an ** ANOMALY ** here! If you look up FontMetric(7, "Arial", 9) in Windows NT, you get 16 pixels (FontMetric(6,...) is 5 pixels), which seems reasonable. However, if you do the same thing in Windows 98 the answer is 32! This means that any field you size by this method will come out twice as wide when run on Windows 98 as it does in NT. Wonderful! Where does 32 come from? Who knows? The workaround is NOT to use the FontMetric() at run-time. Find out what it is, fudge it as necessary, and code it in. this.Width = len("FieldName") * 16 && FontMetric(7) (The FontMetric() usually doesn't fit exactly anyway.) This came up in a ProFox discussion - so far as we know it only applies to Arial 9-pt, but of course that's by far the most frequent font/size used in VFP controls. Dan Covill ---------------------------------------------------------------------- RE-CREATING LOCAL VIEWS by Stephen Settimi Don't Let Local Views Get in the Way of Your Vision! Local Views have been known to be occasionally problematic. If you REQUERY() frequently and suddenly notice that the view isn't returning anything when you know the query should, you've had this experience. Next time, try this. First, run GENDBC on your DBC. In fact, this should be done routinely if you're developing a DBC (make it part of your Project Hook Class.). It's an indispensable resource! Then in code SET PROCEDURE TO [name of the GENDBC output file]. Either before a REQUERY(), or after and having tested for RECCOUNT() returning zero records, and knowing it just can't be!, do a double check. Make a call to your procedure file like so, "MakeView_"+[name of local view]. Every table, every view, every object of the DBC has a "make" function (MakeConn, MakeTable, etc...). The view will be automatically recreated on-the-fly, saving you beaucoup time! Stephen Settimi www.Settimi.org ---------------------------------------------------------------------- WHERE CAN I FIND...? A (semi) permanent list of places to look for technical help when you get blind-sided by the latest urgent requirement. We don't give specific URLs for MSDN articles because (a) they're too long and (b) they change too often! ------------------------------- MSDN ON LINE: There's a ton of stuff here, look at the Magazines tab, and read some of the regular columns. MSDN Library Look in Technical Articles | Visual Studio | Visual FoxPro 3-Tier Apps: MSDN Library: "Building Three-Tier Client/Server Applications with Visual FoxPro" ADO MSDN Library: ADO Jumpstart for Microsoft Visual FoxPro Developers John V. Petersen, April 1999 DNA (Distributed interNet Architecture): MSDN On-line: "Top Windows DNA Performance Mistakes and How to Prevent Them" MTS: Microsoft Transaction Server MSDN Library: "Microsoft Transaction Server for Visual FoxPro Developers" ODBC: MSDN Library: "Using Visual FoxPro to Access Remote Data" VS Installer: MSDN Library: a. "Using Visual Studio Installer for VFP 6.0 Applications" b. "VFP 6.0 and VS Installer Tutorial" Windows General XML - What's New in XML for Microsoft Windows 2000 [Contributions solicited. DC] ====================================================================== OTHER STUFF ====================================================================== MICROSOFT TRAINING IN SAN DIEGO Thad V'Soske Microsoft Training & Services Technology Week September 18-22, 2000; San Diego, California "Attend this worldwide technical trainer event featuring new technologies and curriculum for SQL Server 2000, Exchange 2000 Server, e-commerce, Windows 2000 and more. Registration deadline is September 13th." ---------------------------------------------------------------------- SOFTWARE ENGINEERING COURSE This fall, UCSD Extension is offering a Software Engineering course focusing on the initial stages of the software development lifecycle. The course is run as a phase of a software development project, and students will be involved in all aspects of developing a conceptual design for a calendaring and scheduling system, including identifying, interviewing and observing stakeholders, creating conceptual models, designing new workflows, and reviewing prototypes with users. The course begins on 26 September. The charter for this course is online at: The charters for all four courses in the series are online at: You can enroll in the course online at: If you have any questions about the course, you can contact me (the instructor) directly. eric@softwarestudio.org ---------------------------------------------------------------------- VFP6 AVAILABLE AT DISCOUNT by Dan Covill Anybody need a bargain on VFP6? One of my clients has a new, shrink-wrapped VFP 6.0 upgrade, plus the Programmers Guide, that he doesn't need. You can have it for $225 (a $300+ value). Call me at (858)272-2448, or e-mail dcovill@san.rr.com. ---------------------------------------------------------------------- MICROSOFT CALENDAR This should be of interest to all developers: submitted by Nick Nikula ---------------------------------------------------------------------- ANOTHER DAY DONE by Gene Wirchenko Another day done All targets met All systems fully operational All customers satisfied All staff keen and well motivated All pigs fed and ready for take off [Gene Wirchenko is a VFP programmer living in Salmon Arm, BC, Canada] genew@shuswap.net] ---------------------------------------------------------------------- SO MUCH FOR WYSIWYG by Stephen Pemberton (Excerpted from an article in INTERACTIONS, the journal of ACM SIGCHI) [A quotation received by a client said "syntax error" in every place there should have been an amount of money.] So what had happened? Well, the person creating the document had used the English version of the major word processor. It allows you to say in tables "product(left)" and "sum(above)" to calculate values. Unfortunately his colleague who checked and printed the document used the Dutch version of the major word processor, and "product" is spelled "produkt" in Dutch, and "sum" is spelled "som." The major word processor, rather than storing the calculations in a language-independent manner, apparently stores them literally in the language of the creator (so much for localization), and doesn't convert them when you open the file in another language version (so much for portability of documents). And when you load a file into the major word processor, it doesn't re-calculate the values of table elements, but just uses the values there, so it looks all right. However, if you print a document it does recalculate, and rather than tell you that there was a problem, prints it off with error messages in it. So much for WYSIWYG... ---------------------------------------------------------------------- WINDOWS SOURCE CODE [from www.softsci.com] Windows 3.0, 3.1, 95, 95b, 98, 98se, NT, NT/sp3, NT/sp4, NT/sp5, 2000... Many of us have felt confused and helpless just by trying to name many versions out there. Wouldn't it be nice to not only be able to name *all* of the version numbers but also have complete understanding how Windows works? Finally - programmers' dreams come true! One look at the code below will give anybody complete understanding of how Windows works ['works' may be too strong a word... backspace... backspace... backspace... backspace... oh well]. /* TOP SECRET Microsoft(c) Code Project: Chicago(tm) Projected release-date: MAY 1998 $History$ */ #include "win31.h" #include "win95.h" #include "evenmore.h" #include "oldstuff.h" #include "billrulz.h" #define INSTALL = HARD char make_prog_look_big[160000000]; void main() { while(!CRASHED) { display_copyright_message(); display_bill_rules_message(); do_nothing_loop(); if (first_time_installation) { make_50_megabyte_swapfile(); do_nothing_loop(); totally_screw_up_HPFS_file_system(); search_and_destroy_the_rest_of_OS/2(); hang_system(); } write_something(anything); display_copyright_message(); do_nothing_loop(); do_some_stuff(); if (still_not_crashed) { display_copyright_message(); do_nothing_loop(); basically_run_windows_3.1(); do_nothing_loop(); do_nothing_loop(); } } if (detect_cache()) disable_cache(); if (fast_cpu()) { set_wait_states(lots); set_mouse(speed, very_slow); set_mouse(action, jumpy); set_mouse(reaction, sometimes); } /* printf("Welcome to Windows 3.11"); */ /* printf("Welcome to Windows 95"); */ printf("Welcome to Windows 98"); if (system_ok()) crash(to_dos_prompt); else system_memory = open("a:\swp0001.swp" O_CREATE); while(something) { sleep(5); get_user_input(); sleep(5); act_on_user_input(); sleep(5); } create_general_protection_fault(); } ---------------------------------------------------------------------- SOLUTIONS CONSULTING GROUP IS NOW ALITUM Solutions Consulting Group is now Alitum. They are moving their office to 10509 Vista Sorrento Parkway. They host for our Sorrento Mesa meetings. But who are they, and what do they do? "Since its inception in 1993, Solutions Consulting Group has grown to more than 40 employees with over 65 active clients throughout Southern California. We are a Microsoft Certified Solution Provider Partner and a member of the Oracle Business Alliance Program." They do: Corporate Application Development Data Warehousing Network Services They work in FoxPro, VFP, VB, Access, SQL, and Oracle. They are looking for more employees and they do use contractors as well; contact Armando Andrade at if you're interested. For More Information... --------------------------Administrivia------------------------------- This newsletter is a service to members of the FoxPro Developers Network of San Diego (FPDN). The editor (Dan Covill) is solely responsible for the content, Barbara Peisch does the distribution. E-mail the editor YOUR tips, comments, complaints, and rebuttals. Editor: Dan Covill 858-272-2448 Board of Directors: Eric Lendvai - President 760-734-4929 Art Bergquist - Vice Pres 760-740-0428 Claude Nikula - Secretary 619-615-6318 Barbara Peisch - Treasurer 760-729-9607 Dan Covill - Director 858-272-2448 Thad V'Soske - Director 619-544-9900 ----------------------------------------------------------------------