Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sub-classing
Message
From
02/04/1997 20:17:40
Larry Long
ProgRes (Programming Resources)
Georgia, United States
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Miscellaneous
Thread ID:
00025781
Message ID:
00026700
Views:
40
>>>>Actually vcx's are class libararies that store classes. And classes are a must if you do OOP. In VFP you should subclass the base classes of everything and then subclass those for each application for a start. Read Arnon's article on OOP in the VFUG newsletter section.
>>>
>>>SO OOP is like clicking on a gif in netscape that points to
>>>something further? Is that what it can be compared to?
>>Let me give it a shot...
>>OOP is like a building a machine (car for example)
>>
>>Each final OOP program is like a particular type of car that rolls of the assembly line.
>>When a car it built, they dont make all 100000 odd parts and put them all together one-by-one (sequential programming). They install different pre-built assemblies. Any given assembly will be made of individual parts, or other sub-assemblies. The indiviual parts correspond to OOP objects and the assemblies correspond to classes
>>
>>Each part has it's properties height, weight, color, etc. An object has properties too...font, bold,etc..
>>
>>One of the greatest strengths of OOP is that you can re-use classes throughout your application and other programs. For example, a Mustang brake assembly might be used an an Escort. You define the properties of a class one time and if you want to change a property (say screen color) you change it once in your class definition. Every place that you used that class in your program (called an instance) the color will change (inheritance). If you do not want every screen's color to change, you can go to the instance and override the inherited screen color with whatever you want..
>>
>>Another big difference is that OOP is event based. This means that your program performs actions as each object is "clicked" on. This is done through the use of the objects methods. You have methods available for example when object gets attention (by tabbing or clicking on it), you might want to show it bold and hide some other object. You would do this by setting the appropriate properties in the "GotFocus" method. Perhaps
>>
>>this.bold=.t.
>>thisform.otherobject.hide
>>
>>When you click on it again you might want it to go to turn off the bold and go to another control button. In the "Click" method you would add somthing like..
>>
>>this.bold=.f.
>>thisform.othercontrol.setfocus
>>
>>There is a ton of stuff that you have to figure out, heaven knows I'm just starting myself. But I think that you will agree that it is a leap forward and one that can be easily transferred to any visual language.
>>
>>I am fairly new to OOP so please take what I said with a grain of salt. If anyone see's anything wrong with what I said, I would appreciate your comments.
>>
>>Welcome to the world of OOP!
>>Larry
>
>Thanks Larry for that explaination. I get the idea better.
>One thing however, if you want a class from 1 app to apply to another, do you simply insert the code?

When you build your classes, which will be built from any combination of classes and other objects, you save it in a class library. For example, I created a class that I use for dates. I took the textbox object and added code to the methods that make the up and down arrows go up a day and down a day, pgup goes back a month, pgdn forward a month, spacebar go to today's date and home resets the original value. I thought this to be much nicer than having the user punch in the date keystorke by key stroke, especially since we are now going to be looking at 8 keystrokes (mm-dd-yyyy). I saved it as a class in my library and now when ever I need a date field in a form, I just pick it from my library. Piece of cake!
L.A.Long
ProgRes
lalong1@charter.net
Previous
Reply
Map
View

Click here to load this message in the networking platform