GRAFUG Meeting May 10, 2008

Thanks to everyone who attended the May 10, 2008 GRAFUG meeting.

News

We talked about the new Help file for VFP 9 that has been released. They fixed the index, but broke something else. It was suggested that before you download the new help file, you make a copy of the existing one. This way, you can have both versions and switch between whichever one works better for you.

 

We also discussed the fact that Microsoft has agreed to look into some of the major bugs introduced by VFP 9 SP2, such as the nasty Data Group bug in the Report Writer. No promises from them .. but we are keeping our fingers crossed!!

 

Just an FYI … It was mentioned that some older VFP links on the MSDN website seem to be broken.

Main Topic

Mike Feltman from F1 Technologies gave us a sneak preview of his Southwest Fox session titled “Collections, Arrays & Iteration”. It was a very enlightening presentation. For example, Mike showed three ways to iterate though a collection. The first way used a FOR loop to walk through the items. The second way used the FOR EACH loop to walk through the collection. And the third way used the FOR EACH loop with the FOXOBJECT clause (which specifies the element will contain ONLY native (not COM) Visual FoxPro objects. What surprised us is the speed of the various loops. The first example (FOR) was the fastest!! The second example (FOR EACH) was the slowest .. by a significant amount. The third example (FOR EACH w/ FOXOBJECT) was similar in time to the first example. So the moral of the story here is use FOR EACH .. or be sure to use FOXOBJECT when you use FOR EACH!

 

A downside to using collections in your app is that debugging is difficult. In the debugger, the objects aren’t exposed. Mike showed us a sneak preview of a Collection Explorer he’s working on that helps you drill into collections and see the values during the debugging process.

 

Mike Potjer also mentioned that Drew Speedie had included a concept in MaxFrame that was helpful. Each Collection object had an empty array property and a method called Unravel. While debugging, you could jump to the command window and This.Unravel() to run the code in the method, which copies the collection into an array. Now you can look at the array in the debugger. Very interesting idea!

 

Another concept that Mike (Feltman) showed us is how to use collections to generically talk to the objects on your form. Here’s the scenario .. you have a form with a pageframe. Within that pageframe, you have a handful of pages. On each page, you have a bunch of controls. Any time you want to address a control you have to use ThisForm.pgfWhatever.page1.txtMyTextBox. This can be tedious and lead to some long lines of code. Even worse .. if you move a control from Page1 to Page3, you just broke all the code that references the object.

 

Mike showed us some functions he created that helps overcome this problem. For example, to reference an object on the page he does this:

 

                lo=F(‘MyTable.MyField’)

                lo.Property = ???

 

The F() function receives the name of the control source and it iterates through the form looking for an object with that controlsource and returns a reference to the object. This eliminates having to know where the object resides. To improve performance, you can load up a collection with all the control sources and their object references. Of course, if you do anything on the fly you’d have to adjust the collection. Mike had some slick examples and the performance was instantaneous. Some of us were skeptical that we’d see a lag .. but we didn’t. Mike manipulated properties on the form and it went through several pages instantly and we didn’t see any lag time at all.

 

Mike said he’d send us some code to pass out to our members so as soon as we get that, we’ll put it on our website and send out the password to our members.

 

Thanks Mike … it was a great presentation and many of us are ready to start implementing some of this in our apps.

Next Meeting

Our next meeting on June 14th is a special all-day seminar presented by Andy Kramek and Marcia Akins. They will be presenting the following 5 topics:

 

Reservations are required and there is a nominal fee ($10 for members, $40 for non-members) which includes snacks & lunch. For those of you that have already signed up, I’ll send out a reminder email soon (and nag those of you have who haven’t paid yet). There are still a few seats left, so if you’re interested or know of someone who is, please get in touch with me ASAP.

 

~~~~~~~~~~~~~~~~~~~~~

Cathy Pountney

GRAFUG President & Secretary

www.grafug.com

 

If you'd like to be removed from our mailing list, or this email did not reach your preferred email address, please let me know.