====================================== FoxPro Developers Network of San Diego ====================================== FoxDev TipsLetter #02-03 13 March, 2002 Website: Editor: ---------------------------------------------------------------------- CONTENTS: * Calendar * Tech Tips: Generating a Date Lists Steve Settimi Memvars in Textboxes Dan Covill With/Endwith Problem from ProFox * Links: Where Can I Find...? * Other Stuff: Microsoft to Split Horizontally Utilities Wanted Thad V'Soske * Administrivia ** Note address changes (courtesy COX@Home) ====================================================================== CALENDAR: *** NOTE SPECIAL DATE *** Thurs - April 11 - Doug Hennig ------------------------------- This presentation will discuss what it takes to generate a CHM file and how to automate the generation of HTML from Word documents. Word adds a lot of unnecessary things in an HTML file, and Doug will show how to stripp that out. He'll show how to generate the various files required by the HTML Help Workshop, and finally, how to crank out the CHM file. NOTE: Doug will also be speaking on the 10th at OC Fox (www.ocfox.org) on "Scripting Your Applications For Maximum Flexibility." *** More Special Dates: Thurs - May 16 - Drew Speedie ----------------------------- Tips and Trick with VFP Thurs - June 13 - Mike Stewart ------------------------------ Microsoft's Mike Stewart will be presenting his topic on software testing. For those of you who were at the San Diego Devcon, he did this presentation there. Coming later: ------------- Victor Campos, Mike Feltman, Bill Gates, Kenneth Lay, and the concession manager at Sea World. Stay tuned, more at 11. ------------------------------- Escondido meetings are at Bergelectric, 2222 Meyers Avenue. All meetings are at 6:30 pm. Take the Nordahl exit from Highway 78 (west of I-15). Head South, cross Mission at the lights. Next right onto Meyers Ave. Berg Electric is a one-story building on the right, just before Oper Street (there's no sign). ====================================================================== TIPS ====================================================================== GENERATING DATE LISTS by Stephen Settimi Here is a bit of code to generate either a one column cursor or one column array of date ranges, for use in a listbox or elsewhere. The 1st paramater is the number of days before today to begin the list (say, starting 15 days ago), the second the total number of days to generate (say 90). Parameters are optional, the default is 10/90 in a a public array aDayList, if no cursor specified, defaults to the array ___________ CreateDayList() && creats public array w/default 10/90 CreateDayList(15,90) && create public array for 15/90 days CreateDayList(15,90,"mycursor") && creates cursor Procedure CreateDayList Lparameters iFirstDate,iLastDate,cCursor If Vartype(iFirstDate)!="N" iFirstDate=10 iLastDate=90 Endif If Vartype(cCursor)!="C" Public Array aDAyList[iLastDate] Else Create Cursor (cCursor) (Date d) Endif For i = 1 To iLastDate If Vartype(cCursor)!="C" aDayList[i] = ; Iif(i<11,-1*(iFirstDate-i)+Date(),Date()+(i-iFirstDate)) Else Insert Into (cCursor) (Date) Values ; (Iif(i<11,-1*(iFirstDate-i)+Date(),Date()+(i-iFirstDate))) Endif Endfor * Stephen Settimi * GNS Information Technologies, Inc * SSettimi@GNSInfoTech.com [Ed note: You can simplify this code quite a bit as follows: local Date0 Date0 = date() - iFirstDate - 1 && before Date 1 for I = 1 to iLastDate (generate entry for Date0 + I) endfor But it works as given. DC] ---------------------------------------------------------------------- MEMVARS IN TEXTBOXES by Dan Covill Textboxes on a form do NOT treat memvars the same way they do data fields. Oh? And so what?, you say. Well, here's how Joe and I got bit. Standard drill - ask user for a Department code and look it up, If not there show him a pick list. lcDept = space(4) do form GetDepartment (which has a textbox for m.lcDept) seek lcDept if not found() (show the picklist) Problem is, the seek NEVER finds the code. Why not? Turns out that after the user enters something in the textbox, our memvar is no longer 4 characters long. It's something like 15, or 25, or even 47 bytes! In fact, it depends on the length of the box itself (measured in Arials, or Angstrom units, or something). If you make the box wider there'll be more characters in the value returned! So our seek failed because our test value had grown. This never happens if the ControlSource is a data field; the result is always the same size as the field. But if the ControlSource is a memvar, entering data will change its length. How to control this? We found two workarounds. One way is to use left(lcDept, 4). A better and cleaner way is to set the InputMask property of the textbox to 'XXXX' (as many 'X's as the width you want). That controls the size of the result, and everything works as desired. Dan Covill dcovill@san.rr.com ---------------------------------------------------------------------- WITH/ENDWITH PROBLEM from ProFox Original Message: from Lew Schwartz Has anyone else experienced the following bug(VFP6/sp4)? It occurs in with/endwith blocks in session objects. Skeleton code looks like: with this select replace with . *-- produces a variable not defined error endwith Using a full object reference instead of the with/endwith construct works fine, however explicitly saving the this ref (ie oRef = this.etc..., with oRef ....) does not. Reply from Volodymyr Grunchyshyn (Ukraine): Yes, it is a problem. The best practice is to assign object property to a local variable. This works reliable and have better performance in many cases where it is accessed by such commands. Following is a list of commands where I found this bug too so far: REPLACE (include batch replacing of few or all reccords) INSERT-SQL SELECT-SQL UPDATE-SQL Menu command (ON SELECTION... command) - command itself accepts syntax, but selecting menu item will cause error ====================================================================== 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 Magazines tab, and read some of the regular columns. MSDN Library Look in Technical Articles | Visual Studio | Visual FoxPro 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" FoxPro 2.6: http://members.aol.com/FoxProResources/fpfp.htm MTS: Microsoft Transaction Server MSDN Library: "Microsoft Transaction Server for Visual FoxPro Developers" 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" VS Installer: MSDN Library: a. "Using Visual Studio Installer for VFP 6.0 Applications" b. "VFP 6.0 and VS Installer Tutorial" VFP Publications: www.advisor.com FoxPro Advisor www.pinpub.com FoxTalk magazine www.hentzenwerke.com Hentzen Publishing (Books, discussion, and downloads) VFP General: MS Developer Applications Forum on Compuserve http://go.compuserve.com/msdevapps The History of FoxPro (submitted by Steve Settimi) www.foxprohistory.org The Universal Thread http://www.universalthread.com The "Wiki" www.wikis.com fox.wikis.com fox.wikis.com/wc.dll?Wiki~FoxForumWiki Here is the most complete set of FoxPro links you're likely to find: 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.honeypass.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 Leave, ProFox listserve www.jamesbooth.com www.foxforum.com www.foxfolk.com www.stevenblack.com www.craigberntson.com WEB Development: www.foxcentral.net Joint effort by Microsoft, West-Wind, and the Universal Thread Lots of news and development info. 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) XML - What's New in XML for Microsoft Windows 2000 See also OLE DB drivers for XML in MDAC 2.6 at "microsoft.com/data" [Contributions solicited. DC] ====================================================================== OTHER STUFF ====================================================================== MICROSOFT TO SPLIT HORIZONTALLY "SURPRISE SETTLEMENT EVENLY SPLITS MICROSOFT; ONE FIRM TO MAKE SOFTWARE, OTHER TO MAKE PATCHES." In a surprise settlement today with nine U.S. states, Microsoft agreed to be split into two independent companies - one that will continue to make Microsoft operating systems, browsers, and server software, and another, potentially larger company that will make patches for Microsoft operating systems, browsers, and server software. One Reuters reporter, meanwhile, questioned the long-term viability of Patchsoft. "This seems like a logical split right now, but what if Microsoft's products improve to the extent that patches are needed less frequently, or perhaps not at all?" she asked. "I'm sorry, I can only respond to serious questions," Blumenthal answered. http://www.satirewire.com/news/jan02/patchsoft.shtml . [submitted by Thad V'Soske] ---------------------------------------------------------------------- UTILITIES WANTED by Thad V'Soske Our FPDN 'Utilities' page contains 2 utilities: http://www.foxdevsd.org/index.asp?page=ResourcesUtilities They sure could use a little company. If you have any helpful FoxPro related utilities that happen to be laying around collecting dust in your developers shop, and you would like to share them freely with the FoxPro world, please let me know. Better yet, send them to Eric Lendvai at eric@elsoftware.com and ask him to add them to the 'ResourcesUtilities' page. Your contribution will directly benefit our membership AND improve the value of our site to the Fox world. P.S. Our site is soon to become a new user group link on VFUG - and they claim to have over 33,700 members! We might even be featured in their March newsletter!! Thad V'Soske tvsoske@hanoverdirect.com --------------------------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@acm.org Board of Directors: Eric Lendvai - President 760-734-4929 eric@elsoftware.com * Art Bergquist - Vice Pres 760-740-0428 abergquist@sbcglobal.net * Claude Nikula - Secretary 619-615-6318 crndev@cox.net Barbara Peisch - Treasurer 760-729-9607 barbara@peisch.com Dan Covill - Director 858-272-2448 dcovill@acm.org Thad V'Soske - Director 619-544-9900 tvsoske@hanoverdirect.com * New e-mail address 3/2002 ----------------------------------------------------------------------