====================================== FoxPro Developers Network of San Diego ====================================== FoxDev TipsLetter #01-07 1 July 2001 Website: Editor: ---------------------------------------------------------------------- CONTENTS: * Calendar ** Several Changes ** * Tech Tips: A Form Resizer for Free Dan Covill * Links: Where Can I Find...? * Other Stuff: FoxGang Party 2001 Barbara Peisch Upgrade Your Problems Ed Leafe 1000 Ways to Round ProFox Forum XP Registration Snafu * Administrivia ====================================================================== CALENDAR: All meetings are in Escondido, at 6:30 pm. July 11 (The 1st Wed in July is the 4th) ------- Our own Art Bergquist will show us how to to use OLE automation from within VFP to control Outlook and Word. August 16 *** SPECIAL DATE *** -------- Rick Strahl - topic TBA Sept 13 *** SPECIAL DATE *** ------- Doug Hennig - topic TBA The day after DevCon Doug, the creator of Stonefield Database Toolkit and regular author in FoxTalk, will be speaking on either the Windows API or new featurs in VFP 7; we haven't decided yet. Or both. Or something else... -------------------------------------------------------------------- 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). ====================================================================== TIPS ====================================================================== A FORM RESIZER FOR FREE by Dan Covill If a user expands the window of one of your forms, it's nice if the controls expand also, to fit the new space. There's an example Resize() method in the Foundation classes, but it doesn't do too much, and doesn't handle containers at all. Stephen Settimi extended this for control groups in our February, 2000 newsletter (available on the Website). Opinions differ on just what should be resized. Should individual controls just be moved around, or should they be expanded also? What about grids? If the space expands, should the font be bigger? Depends on what the user wants. If they're expanding it because the can't read it (Arial 9 on a 1280 x 1024 screen), then they're probably hoping the font will get bigger. If they're expanding it because they need to see more of a grid or editbox, then they probably want the font to stay as it is. Like everything else, there's no one "right" answer. And covering all the bases takes a lot of time and effort. I found the most complete resizer yet, for free, on the ProLib (Germany) site. Written by Markus Winhard, mwResize will expand all controls proportionally, expanding the fonts (if possible) for everything except edit boxes and grids. You can expand those also by changing a property. It's a small VCX, and comes in a couple of versions. Yes, it's not exactly the way I would do it, if I wanted to waste several months at the job. But it works, it works well, and the price is right! //ftp.prolib.de/public/VFP/mwResize4.zip is the one I used. It's VFP6 only, and has English documentation. Add this class anywhere on your form, and add the FrmResize() call to your Form.Resize event. That's all. It's very small and works just fine. //ftp.prolib.de/public/VFP/RESIZE24.ZIP has Code for VFP3, VFP5 and VFP6. These are provided free to all couresy of Juergen Wondzinski (wOOdy), a frequent contributor to the ProFox forum. Thanks, wOOdy! Dan Covill Middleton Consulting Inc. dcovill@san.rr.com ====================================================================== 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 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" 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 General: This is the most complete set of FoxPro links you're likely to find: http://www.cetus-links.org/oo_visual_foxpro.html WEB Development: These products all work well with VFP. WestWind www.west-wind.com FoxWeb www.foxweb.com AFP www.afpweb.com and www.afpages.com X-WORKS www.x-works.com Windows General 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 ====================================================================== FOXGANG PARTY 2001 Barbara Peisch (repeat from last month) The FoxGang Party 2001 will be held at 7:00 pm of the last day of the Advisor Devcon in San Diego, which is September 12. The party will be at the Sheraton, which is the conference hotel, in an area called "Water Works". Details and RSVP at this website: http://63.193.37.117/foxgangparty/foxgang.htm There will be a cash bar and free munchies. Everyone is welcome, but I need to your R.S.V.P. by September 1, so I can give them a head count. If you have questions, e-mail me: barbara@peisch.com ---------------------------------------------------------------------- UPGRADE YOUR PROBLEMS by Ed Leafe [You all know that Ed Leafe is the host of the popular ProFox e-mail forum and co-editor of FP Advisor's tips column. Here's his deathless reply to a recent comment in the forum. DC] Crooks, David L. wrote: Maybe I am missing something, but I do not see ADO as solution to any of my current problems. Ed's reply: Then you have not properly selected your problems. Please contact your Microsoft sales representative, who will explain to you what your problems are, and why they aren't the same problems you had yesterday. You will then be able to re-tool all your development efforts to address these problems, which, coincidentally, are only solvable by upgrading all your Microsoft products. Ed Leafe ed@leafe.com ---------------------------------------------------------------------- 1000 WAYS TO ROUND by Dan Covill You've heard the saying "There are either four ways to do something in VFP, or there are none!" Well, four is far too few! The ProFox forum recently contained this question: "I have a salary that I multiple by 3 and then I need to round down to the nearest 1000. I have tried using the floor and round commands but I am not getting the correct number. Can anyone tell me how to do this? The answers were amazing! Here are 14 of them, some of which work and some that do not. ------------------------------------ 1000*floor(x/1000) ------------------------------------- ? ROUND(3564, -3) Ron Ron: That does not work. It returns 4000 I need it to return 3000. I am looking for something that goes against the conventional rounding. If the number is between say 3000 and 3999 I need it to return 3000. ------------------------------------- Why not try: lns=42500 *--lns*3 = 127,500 ?round(lns*3,-3) Answer : 128000 ------------------------------------- lcValue = TRANSFORM(1973) lcAllButThousands = LEFT(lcValue, LEN(lcValue)-3) lcRoundedDown = lcAllButThousands + "000" ------------------------------------- How about subtracting the MOD (???, 1000) of the calculation to get to the round-down to nearest 1000 ?? ------------------------------------- ? INT(VAL(LEFT( ALLT(STR(nValue)), LEN(ALLT(STR(nValue))) - 3) + [000])) ------------------------------------- lnNearest_thou = int(lnSome_salary * 3 / 1000) * 1000 ------------------------------------- lns = the_salary ?substr(alltrim(str(lns*3)),1, len(alltrim(str(lns*3)))-3)+'000' ------------------------------------- iif(round(Salary * 3,-3)> Salary * 3,round(Salary * 3,-3) - 1000, round(Salary * 3,-3)) ------------------------------------- ROUND(salary/1000,0)*1000 ------------------------------------- INT(salary/1000)*1000 ------------------------------------- IIF(ROUND(xSalary*3, -3) > xSalary * 3, ROUND(xSalary *3, -3)-1000, = ROUND(xSalary * 3, -3)) ----------------------------- number = (int(number / 1000) * 1000 ) ----------------------------- ROUND(((Salary*3)-500),-3) ---------------------------------------------------------------------- XP REGISTRATION SNAFU by Dan Covill As expected, the new "one computer only" registration policy for Office XP is beginning to claim victims. One of the first was David Coursey, Executive Editor of ZDNet's AnchorDesk. His story ran last week at: www.zdnet.com/anchordesk/stories/story/0,10738,2779746,00.html Some excerpts: "PC EXPO, NEW YORK--A funny thing happened on the way to PC Expo: Microsoft killed my copy of Office XP. Or at least that's what the error message said, threatening me with something called "Reduced Functionality Mode" if I didn't immediately insert my original Office disc and have my software reactivated. "If you don't perform the reactivation steps, Microsoft Office will go into Reduced Functionality Mode. In that mode you will not be able to save modifications to documents, or create a new document, and additional functionality may be reduced" said the "help" screen attached to the error message. (The error itself could not be copied and pasted so I didn't save the exact language; I must say I was a little stunned). Why did they do that? Here's what the help screen said: "Due to a significant change in your computer configuration from when Microsoft Office was installed and activated, some important information about your computer needs to be restored, and the product needs to be reactivated to continue to function properly." FRANKLY, I HAVE NO IDEA WHAT I DID, if anything, to change the configuration of my computer. Nor should it be Microsoft's business if I did. As it stands, I am on an airplane, my original Office disk is 6 miles below and 2,200 miles behind me, and Microsoft has just told me that Office will die if I don't immediately reauthorize my copy." [article continues...] One reader's reply had a likely explanation: You probably had the laptop in its docking station when you installed Orifice, so some hardware that goes into their "system ID" hash is "missing" now. [Planning to "upgrade" to Office XP? Windows XP? You might want to give it a little thought first. 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@acm.org Board of Directors: Eric Lendvai - President 760-734-4929 eric@elsoftware.com Art Bergquist - Vice Pres 760-740-0428 abergquis@cs.com Claude Nikula - Secretary 619-615-6318 crndev@home.com 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 ----------------------------------------------------------------------