Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.
These Database Events
fire when a view is created.
PROCEDURE DBC_BeforeCreateView( cViewName )
PROCEDURE DBC_AfterCreateView( cViewName, lRemote )
Parameter |
Value |
Meaning |
cViewName |
Character |
The name of the view being created. |
lRemote |
.T. |
The view is a remote view. |
.F. |
The view is a local view. |
We can't understand why BeforeCreateView doesn't have an lRemote parameter. Whether you create the view programmatically using CREATE SQL VIEW or visually using the View Designer, by the time BeforeCreateView fires, you've told VFP whether you're creating a remote view or a local one. |
As with other before-and-after pairs of events, you can prevent a view from being created by returning .F. in the BeforeCreateView event. The AfterCreateView event simply receives notification that a view was created.
PROCEDURE DBC_BeforeCreateView(cViewName)
WAIT WINDOW PROGRAM() + CHR(13) + cViewName
* Ensure that view names follow the naming convention of using
* "LV_" as a prefix for local views and "RV_" for remote views.
PROCEDURE DBC_AfterCreateView(cViewName, lRemote)
IF (lRemote AND LEFT(cViewName, 3) <> "RV_") OR ;
(NOT lRemote AND LEFT(cViewName, 3) <> "LV_")
MESSAGEBOX(cViewName + " doesn't follow the corporate " + ;
"naming convention for views.")
ENDIF