====================================== FoxPro Developers Network of San Diego ====================================== FoxDev TipsLetter #05-08 August 5, 2005 Website: Editor: ---------------------------------------------------------------------- CONTENTS: * Calendar * From the Editor * Tech Tips: Menu and Toolbar Classes Nick Nikula New RI Builder Andy Rice The Trouble With Themes Dan Covill * Other Stuff: The Latest on VFP9 Comments Considered Harmful? Dan Covill Programmer Salaries John Overland A Study on ......... Dan Covill * Links: Where Can I Find...? * Administrivia ====================================================================== CALENDAR: Please note, we now meet at Microsoft. See the end of this message for details. August 11 - Rick Strahl *** FREE PIZZA *** FREE PIZZA *** FREE PIZZA *** Yes, we want to entice as many people as possible to come to this meeting. We may even have some product from Microsoft for a raffle. ---------------------------------------------- Topic: The Making of Help Builder Help Builder is a rich and powerful Help and Documentation generation tool that was created using Visual FoxPro. Take a look behind the scenes at the technology that went into Help Builder to provide advanced functionality for a very rich desktop application. Find out how to utilize and integrate rich user interface controls that rely heavily on ActiveX control, how to use the Web Browser control effectively for displaying of content as well as editing HTML, see how to integrate Word into your applications both as an editor as well as an automation engine for generating output. We'll also talk about how Help Builder integrates with .NET by using COM Interop in both directions to access .NET functionality for .NET class documentation and by plugging into Visual Studio as an Add-in using .NET -> COM interop. This session provides a whirlwind tour of a host of advanced Visual FoxPro topics that are sure to spark ideas on what is possible with Visual FoxPro. Sept 15 - Rick Schummer Topic: TBA Oct 6 - Barbara Peisch *** NOTE: THIS MEETHING IS ONE WEEK EARLIER THAN USUAL! *** ---------------------------------------------- Topic: Printing with the XFRX preview container The XFRX preview container has a lot of advantages over the native VFP preview screen. XFRX give you the ability to chaing multiple reports together, and these will appear as a single report in the previewer with continuous page numbering across the reports (if you want). The previewer also offers a search feature that the native VFP viewer doesn't have. However, printing from this previewer has its quirks. We'll cover the considerations for different printing options, including the use of the new print dialog included with version 10.2, as well as using your own print dialog. This session will get into the use of the windows API for controlling the printer and the use of the Devmode structure. ---------------------------------------------- All meetings start at 6:30 pm. *** YOU MUST ARRIVE BY 7:00 PM OR YOU WILL BE LOCKED OUT! *** Microsoft: 9255 Towne Centre Dr. Suite 400 San Diego, CA 92121 Directions: http://www.microsoft.com/mscorp/info/usaoffices/southernca/sandiego.asp You will need to take a ticket when you enter the parking structure, but we will be leaving late enough that you won't have to pay to park. When you leave you must use the Town Centre Dr. exit. The gate at the other exit will not operate. Both lobby entrances are labeled "Equity Office". Don't worry, that's the general building lobby, not the entrance to a business office. Head up to the 4th floor. When you enter the Microsoft office, take a right turn and go all the way to the end, into the multipurpose room. ====================================================================== FROM THE EDITOR ====================================================================== I haven't received notice of any Knowledge Base updates for about six months now, so I've removed that section of the newsletter. Maybe there are some, maybe not. Maybe the person who puts them out at MS died and nobody noticed. Thanks to Andy Rice, John Overland, and Nick Nikula for their contributions to this issue. It's always easier when I have some material!! Dan Covill dcovill@san.rr.com ====================================================================== TECH TIPS ====================================================================== MENU AND TOOLBAR CLASSES FOR VFP by Nick Nikula Here is the URL for the VFP menu and Toolbar class I spoke of last night at the meeting. When you down load this product demo version there are two parts you will need. 1st, the Command Bars Library and 2nd, the Builder for the Command Bars Library. Just copy the Builder application (.app) to your VFP Wizards folder. For example: C:\Program Files\Microsoft Visual FoxPro 9\Wizards. For more information, you can read about it in the FoxPro Advisor July 2005 page 11 by Andrew MacNeill. Remember this all native VFP and no OCX controls. Nick Nikula crndev@verizon.net ---------------------------------------------------------------------- NEW REFERENTIAL INTEGRITY BUILDER by Andy Rice Editor's Note: [At the first ever VFP DevCon, at the SD Convention Center about ten years ago, I attended a session on Referential Integrity by the late Tom Rettig. Tom opined loudly that the Referential Integrity builder shipped with VFP was useless. From what I hear, it hasn't changed much in ten years. But in the meantime, Steve Sawyer and Doug Henning designed a replacement for it, and our own Andy Rice has updated that with some modifications to handle problems he encountered, and has very kindly furnished a writeup on how to get one for yourself. Andy's writeup shows you step by step how to get and install the new builder, but there's an easier way: the whole thing is on our website as NEWRI.ZIP, under Resources, Utilities. DC] ----------------------------------------------------- a. Running the stock RI builder can corrupt your DBC. You'll get a ".DBC internal consistency error" and when you try to open the DBC you get "Index does not match the table" b. The FoxPro builder produces some of the hardest to understand code I have ever seen. The NewRI.prg produces readable code, with common functions. There are two steps to follow: 1. ----------------------------------------------------- Part one is Doug Hennig's replacement for the visual builder. You will need to download that from: http://www.stonefield.com/techpap.html See Building and Using VFP Developer Tools (148K). And change this part of sfRiBuildr.cmdOk.Click()s: .... SCAN ... LOCATE for dd_child = allridd.ri_master ; AND LOWER(ridd.dd_insert) = LOWER(d_restrictword_loc) * m.llSaveFound = FOUND() THISFORM.RIMakeNewTr( TRIM(allridd.ri_master), "insert", m.llSaveFound IF m.llSaveFound ***+20040408 amr Need to create an Update trig. on the child. THISFORM.RIMakeNewTr( ALLTRIM( ridd.dd_child ), "update", .T. ENDIF ENDSCAN .... 2. ----------------------------------------------------- Part two is the NewRi.prg that Doug Henning's builder calls. Steve Sawyer has this at his website: http://home.twmi.rr.com/ssawyer. See Technical Info and Tools. I made some changes to that. You can download the modified version from our FoxDevSD.org website. It's under Resources - Utilities. Download NewRi.zip Steve Sawyer has granted permission to post/reuse his code: "Consider any modified version of NewRI.PRG an "open source" project. Just remember that we're all standing on the shoulders of giants..." ssawyer@stephensawyer.com *---------------------- Changes to Steve's program, commented with my initials [amr]: 1. I reformatted the prg to my style. 2. I added a check for a Restrict Update Trigger. - See "Insert Trigger - amr: Or Restrict Update Trigger - both on Child." 3. I renamed OpenParentChild() to lOpenParentChild(). I return .F. if it can not open one of the tables. 4. I added the private variables: m.pcSaveTableOpened - to lOpenParentChild sets to .T. if table open. I always want to close a table not open at the start. m.plSkipValidation - Programmer sets to .T. outside of newRi.prg. Do this before a TABLEUPDATE(), REPLACE, or similar code which triggers the RI. Please ask me any questions. Andy Rice andymrice@earthlink.net ---------------------------------------------------------------------- THE TROUBLE WITH THEMES by Dan Covill Got an e-mail the other day. "Do you know any reason why VFP 8 would show different colors on an LCD screen? We just recompiled from VFP 6 to 8, and now our laptop and one of the client's workstations with an LCD screen have lost all the colors on the pageframe menu." My first answer was, "Can't be. I've been using VFP 8 with a flat-panel monitor for two years, and I built that pageframe you're talking about. Never seen a problem." Well, I'm running locally. Maybe it works different over a network. Maybe it's something about laptops. So I hook up my laptop (which does not have VFP on it) and try the program using my desktop as a server. WOOPS! The pageframe is all white! Sparing you, gentle reader, from the more unsavory details, I eventually stumbled on a hitherto un-noticed attribute of the pageframe, down at the bottom, called .Themes. It was set to .T. If you haven't looked up "Themes" in your VFP 8 or 9 help, I suggest you do so. Now. Basically, it says discard the colors you've selected and let Windows XP decide what it wants to do. My desktop has XP set to Windows Classic - i.e., no theme, while my laptop has the default theme. So the type of screen has nothing to do with it, it's whether the workstation has Windows XP with an XP Theme active. The clients saw it on the LCD workstation because that's their newest machine, and the only one running XP. You can set Themes off for a grid, a pageframe, or a form, but the simplest solution is to set _screen.Themes = .F. at the beginning of your application. That says "Hands Off!" to XP, and everything works the way God intended. Read the "Themes" help, there's a lot more there as well. For example, if you run a 2.x DOS program with Themes on, all the controls disappear from the form!! Dan Covill dcovill@san.rr.com ====================================================================== OTHER STUFF ====================================================================== THE LATEST ON VFP9 Get the latest information about Visual FoxPro 9.0 from: http://msdn.microsoft.com/vfoxpro/letters/ This in Ken Levy's monthly newsletter and is well worth reading. ---------------------------------------------------------------------- COMMENTS CONSIDERED HARMFUL? by Dan Covill Burt Rosen discussed Refactoring at our July meeting. Basically, his talk used the structure and approach of Martin Fowler, with the examples translated to VFP. One of the entries on his "Objectives" slide made some of us sit up and take notice. The objective was to "Eliminate Comments". Whoa! Burt's point is that by using a clear, simple structure and self-explanatory names, many comments become un-necessary. If the code is readable, you don't need comments to tell what it does. Barbara and I jumped on him a bit, basically saying "That's nice, but there are still quite a few situations where the code itself will NOT tell you what you need to know to maintain it." Burt graciously yielded a bit, but I'm not sure we really convinced him, and I know he didn't really convince us. However, he does have a point. The computer doesn't read the comments, it executes the code. A comment is one more thing to get out of sync, and if it doesn't match the code then guess which one is wrong! So, in spite of all we've been taught, if you can make the code really self-explanatory, minimize the comments. NOTE: Burt has a website with many of his articles on it. http://www.softwarenewsandviews.info/ Use the promotion code "SDFOX" to get a free subscription. Dan Covill ---------------------------------------------------------------------- PROGRAMMER SALARIES At the last month's meeting I made a comment during the introduction about computer programmers California State average salaries. I was incorrect about the $43/hour average wage. Here are the correct details: California Year 2004 3rd quarter Hourly mean $36.60 Entry level $23.57 Experienced Level $43.12 San Diego Metro (MSA) Hourly mean $34.52 Entry level $24.03 Experienced Level $39.76 Obtained from www.labormarketinfo.edd.cagov Those of us not retired, but struggling to make it so we can retire before 80 need to be aware of this data. John Overland ---------------------------------------------------------------------- A STUDY ON ................. Dan Covill The ACM Ubiquity newsletter published this study recently. "The Reliability of GRE Scores in Predicting Graduate School Success: A Meta-Analytic, Cross-Functional, Regressive, Unilateral, Post-Kantian, Hyper-Empirical,Quadruple Blind, Verbiage-Intensive and Hemorrhoid-Inducing Study" by John Orlando, PhD It's not a joke, it's a real study, although a short one. Apparently Dr. Orlando is poking a bit of fun at his colleagues. ====================================================================== LINKS ====================================================================== This is 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 MSDN Magazine. Heavy on .NET, you'll have to dig to find the VFP stuff. ADO VFP and ADO - Part 1 of 2 FoxPro 2.6 procedure library: http://members.aol.com/FoxProResources/fpfp.htm ODBC: MSDN Library: "Using Visual FoxPro to Access Remote Data" ODBC drivers are part of MDAC - Microsoft Data Access Components - and are available for download at: "www.microsoft.com/data" VFP Publications: www.advisor.com FoxPro Advisor www.pinpub.com FoxTalk magazine www.hentzenwerke.com Hentzen Publishing (Books, discussion, and downloads) VFP Run-Times: FTP library with complete VFP run-times from 3 thru 8. VFP General: msdn.microsoft.com/vfoxpro Microsoft's official VFP home page www.foxcentral.net Joint effort by Microsoft, West-Wind, and the Universal Thread Lots of news and development info. The History of FoxPro (submitted by Steve Settimi) www.foxprohistory.org The Universal Thread http://www.universalthread.com The "Wiki" fox.wikis.com fox.wikis.com/wc.dll?Wiki~FoxForumWiki fox.wikis.com/wc.dll?Wiki~VisualFoxProLinks Here's another extensive set of FoxPro links: http://www.cetus-links.org/oo_visual_foxpro.html Private websites with useful free info and downloads: www.prolib.de/foxlinks.afp wOOdy Wondzinski www.gatwicksoftware.com Allen Pollard www.ukfug.org.uk British user group www.lafox.org LA user group www.pinter.com/ Les Pinter www.vfug.org/ Virtual Fox User Group www.leafe.com Ed Leafe, ProFox listserve www.jamesbooth.com white papers and tutorials www.foxforum.com www.foxite.com (registration required) A group of Dutch developers - refreshingly geeky. (Don't be put off by the registration - they're not selling anything.) www.stevenblack.com INTL Toolkit and lots more www.craigberntson.com the Crystal Reports guru WEB Development: These products all work well with VFP. AFP www.afpweb.com and www.afpages.com DotFox www.elsoftware.com FoxWeb www.foxweb.com Web Connection www.west-wind.com X-WORKS www.x-works.com Windows General Win32 API (with VFP examples) [Contributions solicited. DC] --------------------------Administrivia------------------------------- This newsletter is a service to all FoxPro developers, provided without charge by the FoxPro Developers Network of San Diego (FPDN). Anyone may subscribe (or unsubscribe) at our web site . The link is on the home page. The Resources button on the website will take you to the back issues of the newsletter. The editor (Dan Covill) is solely responsible for the content. E-mail him with YOUR tips, comments, or complaints. Editor: Dan Covill 858-272-2448 dcovill@san.rr.com Board of Directors: Eric Lendvai - President 760-203-9866 eric@elsoftware.com Art Bergquist - Vice Pres 760-740-0428 abergquist@sbcglobal.net Barbara Peisch - Treasurer 760-729-9607 barbara@peisch.com Claude Nikula - Secretary 619-615-6318 crndev@verizon.net Dan Covill - Director 858-272-2448 dcovill@san.rr.com Pete Rios - Director prios@eltoroexport.com ----------------------------------------------------------------------