Wiki Home

Basics Of OOP


Namespace: VB
An Wednesday Night Lecture, given on Jan 10, 2001 9PM ET, 0200 GMT, by Michael Schwaid.
You can download the sample files for tonight from: ftp://stevenblack.com/foxwiki/files/BasicVFPoop.zip
Our objective tonight is to help newcomers to Visual FoxPro as well as those who aren't taking advantage of the new event paradigm and OOP features (yet).
We'll be looking at inheritance, polymorphism, encapsulation and how they're represented and used in VFP.
After we're done, you should be able to create a new class, subclass an existing class and several ways of instantiating them!
zOrder question came up: The Hackers Guide has much to say about it. Here are some excerpts to the lecture:

ZOrder serves a second function, one that has bollixed us good on a few occasions. ZOrder not only controls the appearance of controls within a form, it also controls the firing order of those controls during key events such as Init, Refresh and Destroy.

. Controls on the same level of a container—form, formset, page, whatever—fire in the order they were added to the form, unless they have been moved from that order. In design mode, the "Send to Back" and "Bring to Front" options manipulate this order. This order is saved, not as an explicit property of our controls, but rather is implied in the order in which controls are saved—the actual record order of the SCX or VCX. In a runtime environment, the ZOrder method provides the same ordering function.

While a form is up and running, a control can be programmatically sent to front by calling the control's ZOrder(0), or to back with ZOrder(1). This has a crucial message for us: Don't mess with the ZOrder while program execution is within one of those events that fires in ZOrder order—Init, Destroy, Refresh and perhaps others—without a great deal of care. As shown in the example below, it's relatively easy to get stuck in a loop with two controls insisting "Oh, no, after you," like Chip 'n Dale. The flip side of this is that a control which teleports itself to the "top" of the stack of controls can short-circuit the stack of other controls waiting to fire their methods, causing a debugging nightmare. Sometimes a Refresh will fire and sometimes it won't. We can see some nice possibilities for this, but if you decide to resort to this tricky method, document it explicitly. Remember—some poor fool, perhaps even you, is going to have to debug this monster long after you've forgotten this trick.

Finally, Destroy events fire in the sequence of ZOrder in effect at the time the Destroy sequence starts. Mess with them within the Destroy event at the risk of your sanity.
Does this mean that you can use ZOrder as a means of maintaining a control as "Always On Top" of it's container... e.g. same as a tooltiptext?
The reason I ask, is that the Tree View Control doesn't have any ToolTip Text's and I wanted to sub-class it to include some, but when I tried (using a Small Shape object (which HAS a ToolTipText property)) it moved around with the cursor, but always UNDERNEATH the Tree View.... --PeterEasson

Session Start: Wed Jan 10 01:06:38 2001

[20:55] {Evan Delay} Tonight's download is at BasicVFPoop.zip.

[21:00] {Evan Delay} Tonight's speaker is Michael Schwaid. Michael has over 20 years experience in the computer industry, from teaching business productivity applications (Word Star, Word Perfect, Wang Writer, IBM Display Writer, 1-2-3, Excel, etc.) to creating customized database applications with dBASE, Clipper, FoxBASE+, Omnis III (Mac), Paradox, FoxPro and Visual FoxPro. Industry experience includes: Medical, Insurance, Loan Originations, and Entertainment.

[21:00] {Evan Delay} Take it away when you are ready Michael!

[21:01] {MichaelSchwaid} Hello everyone! Welcome, and thanks for 'coming' to "Basic OOP using VFP."

[21:02] {MichaelSchwaid} Our objective tonight is to help newcomers to Visual FoxPro as well as those who aren't taking advantage of VFP's event paradigm and OOP features (yet). We'll be looking at inheritance, polymorphism, encapsulation and how they're represented and used in VFP. After we're done, you should be able to create a new class, subclass an existing class and several ways of instantiating them.

[21:04] {MichaelSchwaid} If you haven't already, download the file and open the OOP project. (Make your directory the home directory.)

  • Definitions.txt contains the basic terms we'll be using, such as class, object, instance, etc.
  • Poly.prg is an example of coded classes that highlight polymorphism principles.
  • Employee.scx is a simple form we'll use to demo the OOP features of VFP
  • Base Class.vcx classlib contains subclasses of all the standard VFP controls which can be subclassed through the Class Designer.
  • Personnel.vcx classlib contains two classes: 1) BasicEmployee and 2) Transportation (employee)

    [21:07] {MichaelSchwaid} Hopefully everyone has VFP running. Let's examine the classes using the Class Designer. Open up Base Class first.

    [21:08] {MichaelSchwaid} Is there any one that would like to go over the definitions of classes, objects, Inheritance?

    [21:09] {MarkusVoellmy} How did you get the OLE baseclasses there in? I never get them empty ;)

    [21:11] {MichaelSchwaid} Each one was created by selecting "new" (in the project), then in the dialog box selecting the appropriate control to subclass.

    [21:11] {JimPhilippi} Dang, this must be in VFP6 and I've only got 5 on this system :(

    [21:12] {MichaelSchwaid} Most of what we cover should lend itself to VFP6. You may have a problem with VFP5.

    [21:13] {MichaelSchwaid} The baseclass allow us to customize the controls to our needs and to abstract VFP's Base Class. The abstraction helps isolate us from changes which might come in future versions. Some of the things I like to do in the base class includes adding a release to all controls (not just forms)...

    [21:15] {MichaelSchwaid} But lets back up, VFP allows 2 different types of controls, containers and control objects. A container is used to hold other objects, for example a form contains text boxes and other input controls. Other containers classes include pageframes, pages command groups (contains command buttons), and container classes.

    [21:19] {MichaelSchwaid} The control objects are the ones which do the work, VFP offers: comboboxes, chekboxes, command buttons (can use pictures), and other standard controls like the grid control.

    [21:20] {MichaelSchwaid} Lets use some of the controls, first lets look at the following example.

     loX = NEWOBJECT("basicEmployee", "personnel")
     loX.Ssn = "111223333"
     ? loX.First
     loX.get()
     ? loX.first
     ? loX.last
     ? loX.spouse

    [21:22] {MichaelSchwaid} Jim newobject() only works in 6.0...

    [21:22] {MichaelSchwaid} You should:

     SET CLASSLIB TO Personnel
     loX = CREATEOBJECT("basicEmployee")

    [21:24] {MichaelSchwaid} You should have seen your first ? loX.First should have been blank, and "Mickey" the second time.

    [21:26] {MichaelSchwaid} The loX class is based on the Cst which I've added a release method, so you should be able to type: loX.RELEASE().

    [21:27] {MichaelSchwaid} To use this class within a for run Employee.SCX.

    [21:28] {MichaelSchwaid} Type 111223333 for the SSN and select "Get"

    [21:29] {MichaelSchwaid} This form uses the table employee (I know very creative < bg >), it has 2 rows, Ssn of 111223333 and 222334444

    [21:30] {MichaelSchwaid} Play for a moment (it's not bug proof)!

    [21:31] {MichaelSchwaid} We're going to do a code walk through!

    [21:32] {MichaelSchwaid} If you've had enough close the form and open the employee form in the form designer.

    [21:33] {MichaelSchwaid} is there anyone here not familiar with the Form/Class Designer? Lets take a look at the Add click event...

    [21:35] {MichaelSchwaid} Btw, anyone want to go over the differences between properties, methods and events?

    [21:36] {MichaelSchwaid} Properties are used to replace variables. They allow us to store the data with the class (encapsulation).

    [21:37] {MichaelSchwaid} Methods and events are both places where we can store code. However, code in events are called automatically by VFP, vs methods which we must call (ie functions).

    [21:39] {MichaelSchwaid} When a class doesn't (or can't) encapsulate the data and code is when we start to talk about coupling. Coupling is how classes are connected (by code). The choices are "loose" coupling and "strong" coupling.

    [21:41] {MichaelSchwaid} For example, this form is tightly coupled to the BasicEmployee class (or subclass). Take a look in the click method (of Add)

    [21:43] {RobinHahn} ? oEmp

    [21:43] {MichaelSchwaid} (The load event instantiates the BasicEmployee class)

    [21:43] {MichaelSchwaid} Robin (et al) open the load event.

    [21:43] {MichaelSchwaid} This is what's breaking JP!

    [21:43] {RobinHahn} Done.

    [21:43] {RobinHahn} Got it.

    [21:44] {MichaelSchwaid} I added this to the load event for an important reason.

    [21:45] {MichaelSchwaid} if I dropped it on the form I couldn't assure it would be loaded before all the other controls (they use this object (oEmp) for the controlSource also)

    [21:47] {MichaelSchwaid} In other words, the Load event 'fires' before the init events of the control objects; So we can instantiate the oEmp before the init's Fire...

    [21:47] {MichaelSchwaid} There is a definate firing order to VFP's events.

    [21:48] {MichaelSchwaid} I don't believe so, though I may be wrong.

    [21:48] {RobinHahn} zOrder?

    [21:49] {MichaelSchwaid} zOrder is an event which controls the 'layering' of the objects on a form.

    [21:52] {MichaelSchwaid} Again, the load event is fired before any of the individual controls, so if you have a dependency on 'something' set it up in load.

    [21:53] {MichaelSchwaid} btw, A couple of quick navigation tips: page up & page down (inside a method) with step through all methods.

    [21:53] {MichaelSchwaid} If you haven't tried it, do so now, what the "object" combo box...

    [21:54] {MichaelSchwaid} In a perfect world the code in a method should be kept with a screen or two...

    [21:55] {MichaelSchwaid} In design and properties windows (not in method window): ctrl+home = top level control (ie: form or formset), ctrl+end = last control added

    [21:55] {MichaelSchwaid} Robin, select form ctrl+home moves you to form, ctrl+end moves you to last control...

    [21:56] {MichaelSchwaid} So this form really does nothing more than the commands we had typed (in command window) earlier.

    [21:56] {MichaelSchwaid} Notice the controlsource of controls before we close the form...

    [21:57] {RobinHahn} Yep, works.

    [21:57] {MichaelSchwaid} I'm pointing to oEmp (our middle tier)

    [21:57] {MichaelSchwaid} Alright, let's close this form and open BasicEmployee! Notice on the bottom of properties sheet (the properties we pointed to from the form)

    [21:59] {MichaelSchwaid} We're moving fast but this is very important, if we used memory variables we could easily step on them (memvars) if we open multiple windows...

    [22:00] {MichaelSchwaid} Here each form contains it's own instance of employee and thus can't step on memvars!!!!

    [22:01] {RobinHahn} Didn't you create oEmp in code in the Load? So how did it become a form property?

    [22:02] {MichaelSchwaid} That's where we instantiated the oEmp object. This is where we tell the system what is in the class (the PEM properties, events, and methods)...

    [22:02] {RobinHahn} Oh, so it was a property created visually before, then...

    [22:03] {MichaelSchwaid} You've heard it called the blueprint...

    [22:03] {MichaelSchwaid} (sorry)

    [22:03] {RobinHahn} In the VCX..

    [22:03] {MichaelSchwaid} Yes, I created the form as a last minute piece to show it in action...

    [22:04] {JimPhilippi} Another question, Where does the data come from? Mickey etc.

    [22:05] {MichaelSchwaid} That's where we're heading now, JP. You'll be happy to see how easy it is.

    [22:07] {MichaelSchwaid} Robin, we instantiated the class (created the object) in the load event.

    [22:07] {RobinHahn} But the blueprint was set in the vcx, right??

    [22:08] {MichaelSchwaid} Exactly!

    [22:08] {MichaelSchwaid} Shall we take a look a the blueprint (known at my work as the marching orders)

    [22:09] {RobinHahn} Got it up now.

    [22:09] {MichaelSchwaid} Let's start with the Get method.

    [22:09] {MichaelSchwaid} Notice I'm a big advocate of the local keyword. Also you see I like using the WITH ... ENDWITH. I find it helps with readability.

    [22:10] {RobinHahn} Yep. I see that.

    [22:11] {MichaelSchwaid} The meat is the SQL SELECT, which hopefully you're all familiar with. Then I store the results to the properties.

    [22:11] {MichaelSchwaid} (Notice we're screwed if we have 2 records with the same SSN)

    [22:11] {RobinHahn} I don't understand the last bit of it - the Where. What does = ?lcssn mean?

    [22:12] {MichaelSchwaid} the presumption is the user has typed in the SSN into the properity (ie thru the form)

    [22:13] {MichaelSchwaid} we store that value to a memvar

    [22:13] {RobinHahn} Oh, so that's like 'print'...

    [22:13] {MichaelSchwaid} then use it in the select statement

    [22:14] {MichaelSchwaid} w/o the question mark you could error if the cursor is addressed when the memvar goes out of scope...

    [22:14] {MichaelSchwaid} does that help?

    [22:14] {RobinHahn} Yes, it does. Thanks.

    [22:14] {MichaelSchwaid} other questions on this method?

    [22:15] {MichaelSchwaid} The basic idea of this class is to portray the real employee

    [22:16] {MichaelSchwaid} this one covers the 'basic' employee, and contains info all employees would need...

    [22:17] {MichaelSchwaid} such as their SSN, Name, Spouse, etc. but suppose we have a class of employees which share additional info that the basic emp. doesn't?

    [22:17] {JimPhilippi} So every time the get is called the SELECT is done again?

    [22:18] {MichaelSchwaid} yes... (I'm not trying to present this as the most efficient way, just showing Inheritance)

    [22:18] {MichaelSchwaid} ... for example, lets say for drivers we track their Drivers Lic. no. and date of last accident and ticket...

    [22:19] {MichaelSchwaid} before we move ahead, I wanted to make another suggestion...

    [22:20] {MichaelSchwaid} when you create a new property, always set it's value, that makes it easier to determine where the props. were added...

    [22:20] {RobinHahn} Usually defaults to .F.

    [22:20] {MichaelSchwaid} (when changed they become bold and stand out...)

    [22:20] {MichaelSchwaid} yes

    [22:21] {RobinHahn} So, set it to the proper data type?

    [22:21] {MichaelSchwaid} I'm sure you all know VFP has no strong typing... (you can you assign event if necessary)

    [22:21] {RobinHahn} Don't understand.

    [22:21] {MichaelSchwaid} I normally just press delete then enter so it says [Nothing] (easy to spot)

    [22:21] {RobinHahn} Assign event?

    [22:22] {MichaelSchwaid} The assign event allows you to control what values are stored to a property (can force strong typing)

    [22:23] {RobinHahn} Can you give an example?

    [22:23] {MichaelSchwaid} (ie I could create ssn_assign which would fire anytime I try to update the property....)

    [22:23] {MichaelSchwaid} (the ssn property)

    [22:24] {MichaelSchwaid} the _Assign and _access events deserve further playing with Robin... check them out!

    [22:24] {RobinHahn} Will do.

    [22:24] {MichaelSchwaid} ok...

    [22:25] {MichaelSchwaid} again, notice release is not bold, (because it was set in the cst class)

    [22:26] {MichaelSchwaid} the update, and add are similar that they use the contained properties stored to local memvars....

    [22:26] {MichaelSchwaid} any questions on this class?

    [22:26] {MichaelSchwaid} if not, go ahead and open the transportation class....

    [22:27] {MichaelSchwaid} my objective is to show how this class and it's ancestor class can work together...

    [22:27] {MichaelSchwaid} the ancestor class is BasicEmployee, which VFP lists as 'Parent Class'

    [22:28] {JimPhilippi} Another dumb one.. Is SSN a property? If so why is it showing NONE and not .F.?

    [22:28] {MichaelSchwaid} this is what I was mentioning earlier...

    [22:28] {JimPhilippi} Sorry..

    [22:29] {MichaelSchwaid} I normally store [Nothing] to strings and 0 to numeric, etc...

    [22:29] {MichaelSchwaid} I force it to help me see where the properties have been added...

    [22:29] {MichaelSchwaid} ie: notice here ssn is not bold...

    [22:29] {RobinHahn} On my property sheet, it says Parent Class is Cst

    [22:30] {MichaelSchwaid} I'm seeing BasicEmployee...

    [22:30] {CharlieBlakey} I have CST

    [22:30] {MarkusVoellmy} yoh, robin you're in the wrong one I guess

    [22:31] {MichaelSchwaid} good opportunity to redefine it!

    [22:31] {CharlieBlakey} Transportation?

    [22:31] {MichaelSchwaid} yes

    [22:31] {MichaelSchwaid} load Class Browser (under tools)

    [22:31] {RobinHahn} Transportation... subclass of Personnel.

    [22:32] {MichaelSchwaid} everyone with me?

    [22:32] {RobinHahn} Same. The both share the same level...

    [22:32] {Evan Delay} y

    [22:32] {CharlieBlakey} yup

    [22:32] {MichaelSchwaid} I most have done that last minute (love those last minute changes < s >)

    [22:32] {RobinHahn} < grin >

    [22:33] {tomavery} 'yep

    [22:33] {RobinHahn} So, transportation is supposed to be a subclass of basicemployess

    [22:33] {MichaelSchwaid} anyone NOT see the transporation class in the Class Browser?

    [22:33] {MichaelSchwaid} yes

    [22:33] {RobinHahn} sharing the same properties.

    [22:33] {MichaelSchwaid} yep

    [22:34] {MichaelSchwaid} select transportation in the Class Browser (one click)

    [22:34] {RobinHahn} OK.

    [22:34] {MichaelSchwaid} then the button next to delete is redefine, click it...

    [22:34] {RobinHahn} Ok.

    [22:35] {MichaelSchwaid} click the elipse (...), and select personnel then BasicEmployee, then OK...

    [22:35] {tomavery} 'k

    [22:35] {RobinHahn} 'k.

    [22:35] {RobinHahn} That is HOT!

    [22:35] {MichaelSchwaid} then finally "redefine"

    [22:35] {tomavery} so its now under basic employee

    [22:35] {JimPhilippi} How 'bout in '5?

    [22:36] {MichaelSchwaid} yep very cool, the Class Browser is very important, it auto. changes any references of any open forms and classes!!

    [22:36] {JimPhilippi} Never mind I found it.

    [22:36] {MichaelSchwaid} it's there... JP

    [22:36] {RobinHahn} Wish i'd checked this out oh, about 5 versions of classes ago!

    [22:36] {WilliamSanders} the class browser is my friend - chant the mantra till it clicks :)

    [22:36] {MichaelSchwaid} now what does Parent Class show?

    [22:37] {MichaelSchwaid} < smile >

    [22:37] {MarkusVoellmy} that's funny the same as before BasicEmployee ?

    [22:37] {DenisChasse} Before I also add cst

    [22:37] {CharlieBlakey} BasicEmplyee

    [22:37] {DenisChasse} Now basicemployee

    [22:37] {MichaelSchwaid} sounds like you had the right one Markus...

    [22:37] {RobinHahn} BasicEmployee

    [22:38] {MarkusVoellmy} yeah but the structure in the CB was wrong ?

    [22:38] {MarkusVoellmy} weird

    [22:38] {MichaelSchwaid} I originally had personel with one "p" then changed it and caused this problem... (opportunity)

    [22:39] {MichaelSchwaid} now you should all be seeing the ssn property w/o bold type....

    [22:39] {DenisChasse} yes

    [22:39] {MarkusVoellmy} yes

    [22:39] {RobinHahn} yep

    [22:39] {CharlieBlakey} y

    [22:39] {WilliamSanders} yup - me too!!!

    [22:40] {MichaelSchwaid} I can easily determine which props. have been added here ('cause they're bold)

    [22:41] {MichaelSchwaid} we did nothing besides base this class on the BasicEmployee (in order to see its properties and methods)

    [22:41] {MichaelSchwaid} lets look at the get method!

    [22:41] {RobinHahn} Ah, the 'DODEFAULT()!

    [22:42] {MichaelSchwaid} the DODEFAULT() tells VFP to run this method on the ancestor (parentClass)

    [22:42] {MichaelSchwaid} to see the code which doDefault will run...

    [22:42] {CharlieBlakey} Q

    [22:42] {MichaelSchwaid} (one moment)

    [22:43] {MichaelSchwaid} if the Class Browser is still loaded you should see a button on the toolbar which sits by itself...

    [22:43] {MichaelSchwaid} its tooltip text is "Edit Parent Class method"

    [22:43] {MichaelSchwaid} click it and you'll see the code we saw earlier... (in BasicEmployee)

    [22:44] {MichaelSchwaid} yes CB?

    [22:44] {CharlieBlakey} Is the DODEFAULT there so that the cursor is created first?

    [22:45] {MichaelSchwaid} anyone NOT see the parentclass_basicEmployee.get code?

    [22:45] {CharlieBlakey} otherwise the standard behaviour would occur after the code here

    [22:45] {tomavery} code edit forwindow is not active?

    [22:45] {MichaelSchwaid} if we put code in a method, it hides the code in the parentclass method, doDefault() tell it to run that parentclass code...

    [22:46] {JimPhilippi} < cough cough > not yet...

    [22:46] {MichaelSchwaid} ? JP

    [22:46] {CharlieBlakey} Doesn't it run by default anyway?

    [22:46] {MarkusVoellmy} Q

    [22:47] {JimPhilippi} Haven't found the parent code yet..

    [22:47] {MichaelSchwaid} only if there is no code in the subclass (even if you add a comment it will stop the parentclass code from firing)

    [22:47] {CharlieBlakey} ok thanks

    [22:47] {MichaelSchwaid} JP do you have the class browser open?

    [22:47] {RobinHahn} What does the msg "code edit window is not active" mean?

    [22:48] {MichaelSchwaid} first click into the method to view then click the button...

    [22:48] {MichaelSchwaid} ok RH?

    [22:48] {JimPhilippi} Yep, it's open

    [22:48] {MichaelSchwaid} so you should be able to see transportation.get and basicEmployee.get at the same time...

    [22:49] {DenisChasse} Q

    [22:49] {MichaelSchwaid} I understand the VFP 7 will alow you to view n levels back...

    [22:49] {MichaelSchwaid} yes markus?

    [22:49] {MarkusVoellmy} is it always the Parent Class code or the next found code in the chain upwards that's targeted by DODEFAULT?

    [22:49] {RobinHahn} Open for BasicEmployee...

    [22:49] {MichaelSchwaid} when would the parent code not be next in the chain?

    [22:50] {MarkusVoellmy} if it's empty eg

    [22:50] {MichaelSchwaid} the parent code (if any) would then be fired

    [22:50] {MichaelSchwaid} Denis?

    [22:50] {DenisChasse} Is the button to let us view the parent code there because we instantiated the object in the command window?

    [22:51] {MichaelSchwaid} no, because the class browser is open...

    [22:51] {MichaelSchwaid} close the class browser and it goes away...

    [22:51] {MarkusVoellmy} nope mine stays

    [22:51] {MarkusVoellmy} :)

    [22:51] {DenisChasse} Mine too

    [22:51] {CharlieBlakey} and mine

    [22:52] {MarkusVoellmy} cool

    [22:52] {tomavery} i still cant this button to click

    [22:52] {MichaelSchwaid} I lied, it looks like VFP 6 no longer needs the Class Browser open, I hadn't noticed that...

    [22:52] {MichaelSchwaid} tom are you selected in a method?

    [22:53] {tomavery} im in the browser looking at proerties

    [22:53] {RobinHahn} MS, in the class browser,, having selected 'transportation', should I be seeing methods as well as properties?

    [22:53] {MichaelSchwaid} select the Class Designer and open the get method, Then press the button...

    [22:53] {RobinHahn} Because all I see is properties... 3 of them.

    [22:53] {MichaelSchwaid} only new methods...

    [22:54] {RobinHahn} Colour me a bit thick. What is the 'Class Designer'?

    [22:55] {MichaelSchwaid} the class designer is the tool which opens when you double click the class in the project....

    [22:56] {RobinHahn} Doh.

    [22:56] {MichaelSchwaid} there are no new methods to transporation (just properties)

    [22:56] {RobinHahn} Thanks.

    [22:56] {tomavery} there it is, had to open transportation then clicked get in the properties then clicked the button

    [22:56] {MichaelSchwaid} yea!!!!!!

    [22:56] {MichaelSchwaid} back to get...

    [22:56] {RobinHahn} Got it.

    [22:57] {MichaelSchwaid} dodefault did all the code in the parentClass (which leaves the EmployeeCurs cursor open...

    [22:57] {MichaelSchwaid} then this method stores the last of the properties (needed only by drivers)

    [22:57] {MichaelSchwaid} make sense?

    [22:57] {RobinHahn} Yes, MS. Perfectly.

    [22:57] {MarkusVoellmy} yes

    [22:57] {DenisChasse} so far so good

    [22:58] {CharlieBlakey} nice one

    [22:58] {RobinHahn} New concept, manipulating data as object.

    [22:58] {MichaelSchwaid} you notice the destroy (of BasicEmployee) closes any open tables/cursors....

    [22:59] {MichaelSchwaid} in the real world I use the SCATTER TO NAME to place these properties into a 'collection'...

    [22:59] {MichaelSchwaid} a collection allows us to navigate through the properties like an array...

    [23:00] {MichaelSchwaid} WELL, we've covered a lot of gound this evening, questions?...

    [23:00] {DenisChasse} When is the part 2 of this presentation? :-)

    [23:00] {RobinHahn} Yes!

    [23:00] {tomavery} would we modify the transportatin to include the trims and all that for the other properties.

    [23:00] {RobinHahn} We want more!

    [23:00] {MichaelSchwaid} let's look at one more tool which can help you understand all of this...

    [23:01] {MichaelSchwaid} yes your right, it should have the trims...

    [23:01] {MichaelSchwaid} close the classes...

    [23:02] {MichaelSchwaid} run the Employee form

    [23:02] {MichaelSchwaid} let me know when you're ready....

    [23:02] {RobinHahn} Ready.

    [23:02] {MarkusVoellmy} k

    [23:02] {CharlieBlakey} ok

    [23:02] {DenisChasse} ok

    [23:02] {MichaelSchwaid} type 222334444 as the SSN and press 'Get'...

    [23:02] {tomavery} 'k

    [23:03] {RobinHahn} Nice

    [23:03] {MarkusVoellmy} heh

    [23:03] {tomavery} debug came up

    [23:03] {MichaelSchwaid} now for the fun part, VFP has great tools for inspecting the objects...

    [23:03] {JimPhilippi} Unknown member oEmp

    [23:03] {MichaelSchwaid} why tom?

    [23:03] {tomavery} it says it cant find personenel .vcx

    [23:03] {tomavery} 'must have missed somethn

    [23:03] {RobinHahn} Path problem

    [23:03] {MarkusVoellmy} yoh I had that one once bfore too

    [23:03] {RobinHahn} Put it in the root dir...

    [23:04] {MichaelSchwaid} this worked earlier right? if necessary quit out and come back in...set the directory to where these files are...

    [23:04] {RobinHahn} I had to do that.

    [23:04] {MarkusVoellmy} I think the vcx is flaky

    [23:04] {RobinHahn} Anyway, on to the cool tools.

    [23:04] {MichaelSchwaid} type CD < my path > to place VFP in same directory...

    [23:05] {MichaelSchwaid} everyone running?

    [23:05] {MichaelSchwaid} anyone NOT running?

    [23:05] {DenisChasse} running

    [23:05] {RobinHahn} running

    [23:05] {MarkusVoellmy} k

    [23:05] {JimPhilippi} Me, not running

    [23:05] {WilliamSanders} RNG

    [23:05] {MichaelSchwaid} that's because of newobject, you in the debugger?

    [23:06] {MichaelSchwaid} JP?

    [23:06] {MichaelSchwaid} when running open the debugger...

    [23:06] {JimPhilippi} not in the debugger

    [23:06] {tomavery} that did it

    [23:06] {MichaelSchwaid} JP where are you?

    [23:07] {tomavery} oh this is awesome Hillery!

    [23:07] {MichaelSchwaid} anyone can't open debugger?

    [23:07] {JimPhilippi} Ok sorry, I'm there

    [23:07] {MichaelSchwaid} where?

    [23:07] {MichaelSchwaid} at error?

    [23:07] {JimPhilippi} In the debugger

    [23:07] {DenisChasse} in

    [23:07] {RobinHahn} in

    [23:07] {MichaelSchwaid} ok, JP type "SET CLASS LIBRARY TO Personnel"

    [23:08] {MichaelSchwaid} thisform.oEmp = createObject("basicEmployee")

    [23:09] {JimPhilippi} Ok

    [23:09] {MichaelSchwaid} then run and ignore through error, that should get you going JP...

    [23:09] {MichaelSchwaid} open the watch window (in debugger)

    [23:09] {RobinHahn} open

    [23:09] {DenisChasse} ok

    [23:09] {MichaelSchwaid} there type "_screen" and press enter

    [23:10] {ScottBarker} Hey, Evan ... not bad ... just dropping in to see whats up

    [23:10] {MichaelSchwaid} there type "_screen" and press enter you should see _screen w/ + of type (object)....

    [23:10] {MichaelSchwaid} everyone follow that?

    [23:11] {RobinHahn} Cool, cool - COOL! Lookit it all!

    [23:11] {MarkusVoellmy} yes

    [23:11] {DenisChasse} yes

    [23:11] {MichaelSchwaid} you should be able to drill into oEmp and inspect the properties...

    [23:11] {JimPhilippi} Finally, I'm running....

    [23:11] {MichaelSchwaid} the properties can also be used to set breakpoints just like memvars....

    [23:12] {MichaelSchwaid} Well this should hopefully give you all something to get started with!

    [23:12] {MichaelSchwaid} I'd be glad to offer a part 2 if requested...

    [23:12] {MichaelSchwaid} ANY QUESTIONS?

    [23:13] {tomavery} homework before part 2?

    [23:13] {DenisChasse} If you have material for a part 2 I'll be there :-)

    [23:13] {Evan Delay} *applause*

    [23:14] {JimPhilippi} Where can I look for more on the debugger?

    [23:14] {RobinHahn} Please, please do a Part 2!

    [23:14] {MichaelSchwaid} force yourself to use properties instead of memvars... < s >

    [23:15] {MichaelSchwaid} The Vf P Programmers Guide is a great source!

    [23:15] {DenisChasse} Michael: Not only did you show us things about OOP but also an intro. to n-tier. Really nice


    Contributors: Michael Schwaid, Evan Delay, Cindy Winegarden

    Category Wednesday Night Lectures