5 |
The LA Fox Developer Newsletter
|
July 1999
|
VFP Hot Tips...
Gathered from the Internet
Customize the String Used for Commenting in Visual FoxPro 5.0
by Dan Freeman
Visual FoxPro 5.0 supports commenting or uncommenting code with a right click or a menu selection. You can customize the string used for commenting (to include your initials, for instance) by adding one key to your registry.
Run REGEDIT. Cpen the following key:
HKEY_CURRENT_USER/SOFTWARE/MICROSOFT/
VISUALFOXPRO/5.0/OPTIONS
From the Edit menu, select New/String Value. Name the value EditorCommentStnng.
Double click the new entry and type the string you want the commenting to use. Note that you’ll have to provide the *entire* string, including the asterisk.
Here’s how mine looks:
*! dif !*-- m.g_devcompany
=
PADRE c_hdr_company_LOc ,45," ")
*! djf !*-- m.g_devaddress
=
PADFt( c_hdçaddress_LOC ,45,"
"0
*! djf !*-- m.g_devcity
=
PADR( c_hdr_city_LOC ,45,"
")
Have Your Label’s BackColor Match Your Form’s BackColor Automatically
-
Visual FoxPro
by Walt Grogan
When
you drop laoels onto a form, the Label.BackColor doesn’t default to the Form.BackColor even though that’s almost always what you want. Then, if you change the Form.BackColor, you might find yourself having to go back and changing all your Label. BackColor properties to match.
Or, you could set each Label.BackStyle property to 0-Transparent. This will allow the color of the form to bleed through to the
label.
There are several Visual FoxPro controls besides Labels that also support the BackStyle property. The BackStyle property is set to 1
-
Opaque by default.
This kind of change is the reason you should subclass all the
FoxPro base class controls before creating forms. You can
create a subclass of Labels with the BackStyle property set to
0 and always use that label class.
Right-Click in the Properties Window
-
Visual Foxpro
by Tom Huguelet and Mark Roberts
You
can
right click any property in the Property Sheet and
|
return values to their default state. This is especially useful when you want to reset an object’s attribute to allow that object to exhibit the Parent Class’s behavior. For example, if you’re using a Label class definition, that has FontBold
=
.T., but this instance of the object has FontBold
=
.F., you can recall the Class Definition’s default simply by right-clicking and choosing “Reset to Default”.
This behavior also applies to the Methods in the
Property
Sheet! In other words, you can remove all method code from the method listing by right- clicking. This is a handy way to reset the current object instance to run the Class Definition’s method code. There is no confirmation dialog, however, so you could wind up removing essential code. If you accidentally reset your method code to default, you can get it back by exiting your Form Designer session and answering “No” to “Do you want to save changes to Form Designer
-
myform.scx?”
Parent Class Method Tips
-
Visual Foxpro by Tom Huguelet
You
can
override Parent Class Method code by entering specific code in the associated method of the object instance. FoxPro interprets any characters in the method code as executable code which will override parent class methods, including spaces and comments.
If you want
toadd
comments to method cçde and retain the inher itande, use the Scope resolution operator (::) to explicitly call the Parent Class’ code. The click event procedure for a Command Button might look like this, for example:
MyExitButton::Click
Coordinate Toolbar Buttons and Menu Options
-
Visual Foxpro
by
Tom Huguelet
A straightforward way to coordinate enabling or disabling menu choices in conjunction with Toolbar buttons is to use the Enabled property in the Set Skip clause of the menu. For example, say you have a toolbar called oToolbar with an add Command Button named cmdAdd, and a Record menu with an Add option. By setting the Set Skip clause of the Add option to “oToolBar.cmdAdd.Enabled
=
.F.” or “!oToolBar.cmdAdd.Enabled” the Add menu option is only available when oToolBar.cmdAdd is Enabled.
Remember
-
the Set Skip disables the menu choice when it evaluates to .T., which is why the NOT operator
(!)
or
“=
.F.” is required.
|
Page 5
|
5 |