Q: What are they?
*-- VFP7 program to list base classes
LOCAL ARRAY laTemp
ALANGUAGE(laTemp,3) && Note: new function in VFP7
FOR i=1 TO ALEN(laTemp)
_CLIPTEXT=_CLIPTEXT+ laTemp[i]+ CHR(13)
Q: Should they be subclassed before use?
Q: What are some obvious changes that are good to make?
Combo Box.BoundTo = .T.
Label.Autosize = .T.
Check Box.Autosize = .T.
In the VFP command window, I type MODI FORM myFirstForm, and use the Form Controls thing to place buttons, checkboxes, shapes, and labels on the form. Or I use the Quick Form Form Builder to throw something together. Q: Are the controls placed on myFirstForm base classes or some subclass?
I believe the answer is, it depends on how you set your options.
The second icon in the Form Controls toolbar (looks like a bunch of books, I guess) controls this behaviour. If you hover over it, it says "view classes". If you click it, it gives you a number of preset options and also an "add" option. Add your own base classes, then select them, then use them. I don't know the answer for the quick form builder. Sorry. But I can answer something you didn't ask - how to subclass forms. Go to tools/options/forms/Template Classes and set your own form class in there. Took me a while to find that. Oh, and Set as Default unless you want to be redoing it every time :-) Michael Wagner
Q: Are the Fox Foundation Classes suitable for subclassing?
.... or should they be subclassed individually as needed?
A: Fox Foundation Classes should be subclassed, but for a slightly different reason. You should subclass VFP Base Classes because you'll want the flexibility to make class-level changes further down the road. That's true of the Fox Foundation Classes as well, but in addition, you'll want your classes to be able to benefit from any changes our friends at Microsoft make to the FFC classes.
A good suggestion I saw in Fox Talk with FFC first came out, if you were going to use it, what to subclass all the base classes into your on MyBase.VCX, and then redefine the FFC _base.vcx classes to be based on yours. This way you could...
1. Modify behavior that the FFC inheriets
2. Still reatain your common changes if you didn't want to use an FFC base class.
3. Be able to apply _base.vcx updates without having to reapply your own changes.
Q: How do you PROPERLY subclass the base classes....
What is a good location to go to, to get the exact directions on the Proper way to subclass the base classes? (...Proper... as in...the way the super Professionals do it)
A. Not sure I qualify as a "super Professional", but here's my 2 cents! There are a few of ways to subclass, and you will find that using each method is handy under certain circumstances. Here are three ways in particular, all of them are proper:
(1) Open the Class Browser from the Tools menu. You can open an existing library or create a new one by clicking on the 'Open' toolbar option (which looks like a folder). Now, select the class you want to subclass and click the 'new Class' button. This opens the 'New Class' dialog.
(2) In the project manager, open the Classes tab. Right-click on any object in the class library you want to add to (you can also right-click on anything if you want to create a new library). This opens the 'New Class' dialog.
(3) Drop a control on a form. Select the control and click on the File menu. Click Save As Class. This opens the 'Save As Class' dialog.
All three of these methods essentially get you to the same place: a dialog (either 'New Class' or 'Save As Class') that will allow you to specify the name of the new class or subclass and the file in which it is stored. In addition, you can specify the parent class in the 'New Class' dialog box. In the 'Based on' dropdown list, you can click the '...' to open an existing class that you can base your new one on.
Now, you want to know the proper way to subclass the base classes. I suggest that you open the Class Browser, and add each new class using the 'New Class' dialog one at a time (method 1). If you need to create a container class with other controls (for example, say you want to create a new form class that has a save and cancel button), use method 3. I find that in my projects I use a combination of method 1 and 3 the most (with a splash of #2)
-- Tod Mckenna
Category VFP Controls
( Topic last updated: 2009.11.02 03:23:19 PM )