Tom Rettig's Envlib library for Visual FoxPro, first released in 1995, is modernized and carried-forward.
xBase
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
envlib.prg

README.md

EnvLib for Visual FoxPro 9

EnvLib is a collection of classes that you can use (and aggregate) to save and restore your environment. The classes save, set, and restore SET, ON, open table, system variable, object properties, and other helpers.

The original version of EnvLib for Visual FoxPro was created by Tom Rettig in July 1995. Tom passed away in February 1996. Since then Visual FoxPro has moved forward significantly. This is an updated version of his original library.

Features

  • Over 120 lightweight classes, one for each aspect of the Visual FoxPro environment.
  • Objects save, and optionally set, aspects of the VFP environment upon init().
  • Objects restore their aspect of the VFP environment upon destroy().
  • Therefore facets of the VFP environment are automatically reset when objects go out of scope.
  • Objects can be nested at design-time or run-time to group many aspects into one object.
  • Objects can be configured at creation-time to not reset upon destroy().

Using EnvLib

To include Envlib in your application, simply call SET PROCEDURE ... ADDITIVE prior to using it.

SET PROCEDURE TO <path>\EnvLib ADDITIVE

Example -- saving the current path

In standard Visual FoxPro, saving and setting SET PATH looks something like this:

LOCAL lcAPath
lcPath= SET( "path" )
SET PATH TO newPath  && or SET PATH TO newPath ADDITIVE

* Lots of code here

* Now restore the previously selected work area
SET PATH TO &lcPath   && Do this everywhere you might exit
RETURN

With Envlib, you do this:

LOCAL loAlias  
loAlias= CREATEOBJECT( "SetPath", "newPath" )
* or loAlias= CREATEOBJECT( "SetPath", "newPath", "Additive" )

* Lots of code here

RETURN

Note you don't need to cover every exit point because when lcPath goes out of lexical scope, SET PATH is reset upon its destroy.

Example -- saving the current work area

In standard Visual FoxPro, saving the current work area looks something like this:

LOCAL lcAlias
lcAlias= SELECT()

* Lots of code here

* Now restore the previously selected work area
SELECT ( lcAlias )   && Do this everywhere you might exit
RETURN

With Envlib, you do this:

LOCAL loAlias  
loAlias= CREATEOBJECT( "SaveSelect" )

* Lots of code here

RETURN

Note you don't need to cover every exit point because when loAlias goes out of lexical scope, the work area is reset upon its destroy.

Example -- saving the current work area and setting a new work area

LOCAL lcAlias
lcAlias= SELECT()
SELECT Customer

* Lots of code here

* Now restore the previously selected work area
SELECT ( lcAlias )   && Do this everywhere you might exit
RETURN

With Envlib, you do this:

LOCAL loAlias  
loAlias= CREATEOBJECT( "SetSelect". "Customer" )

* Lots of code here

RETURN

Classes in EnvLib

Abstract Classes

ClassParentNotes
SetCustomAbstract class
SetTwoSet Abstract class
SetOnOffSet Abstract class
SetOnOffTwoSetTwo Abstract class
OnCustomAbstract class
SaveAreaCustomAbstract class
SaveUsedAreaSaveAreaAbstract class

SET Classes

These classes save, set, and restore the various VFP SET commands that have corresponding SET() functions.

ClassParent
SetAlternateSetOnOffTwo
SetAnsiSetOnOff
SetAssertsSetOnOff
SetAutoIncErrorSetOnOff
SetAutosaveSetOnOff
SetBellSetOnOff
SetBlocksizeSet
SetBrstatusSetOnOff
SetCarrySetOnOff
SetCenturySetOnOff
SetClassLibSet
SetClearSetOnOff
SetClockSetOnOff
SetCollateSet
SetCoverageSet
SetColorSet
SetCompatibleSetOnOffTwo
SetConfirmSetOnOff
SetConsoleSetOnOff
SetCpcompileSet
SetCpdialogSetOnOff
SetCurrencySetTwo
SetCursorSetOnOff
SetDatabaseSet
SetDataSessionSet
SetDateSet
SetDebugSetOnOff
SetDecimalsSet
SetDefaultSet
SetDeletedSetOnOff
SetDelimitersSetOnOffTwo
SetDevelopmentSetOnOff
SetDisplaySet
SetDohistorySetOnOff
SetEchoSetOnOff
SetEngineBehaviorSet
SetEscapeSetOnOff
SetExactSetOnOff
SetExclusiveSetOnOff
SetFdowSet
SetFixedSetOnOff
SetFullPathSetOnOff
SetFweekSet
SetHeadingsSetOnOff
SetHelpSetOnOffTwo
SetHelpfilterSet
SetHoursSet
SetIntensitySetOnOff
SetKeycompSet
SetLibrarySet
SetLockSetOnOff
SetLogErrorsSetOnOff
SetMarginSet
SetMackeySet
SetMarkSet
SetMemoWidthSet
SetMessageSetTwo
SetMultiLocksSetOnOff
SetNearSetOnOff
SetNotifySetOnOff
SetNullSetOnOff
SetNullDisplaySet
SetOdometerSet
SetOLEObjectSetOnOff
SetOptimizeSetOnOff
SetPaletteSetOnOff
SetPathSet
SetPrinterSetOnOffTwo
SetPointSet
SetProcedureSet
SetReadBorderSetOnOff
SetRefreshSetTwo
SetReprocessSet
SetResourceSetOnOffTwo
SetResourceCreateSetResource
SetSafetySetOnOff
SetSecondsSetOnOff
SetSeparatorSet
SetSpaceSetOnOff
SetStatusSetOnOff
SetStatusBarSetOnOff
SetStepSetOnOff
SetSysFormatsSetOnOff
SetSysMenuSet
SetTableValidateSet
SetTalkSetOnOff
SetTopicSetTwo
SetTrBetweenSetOnOff
SetTypeaheadSet
SetUdfParmsSet
SetUniqueSetOnOff
SetViewSetOnOff
SetWindowOfMemoSet
SetVfpDefaultsCustom

ON Classes

These classes save, set, and restore the various VFP ON commands that have corresponding ON() functions.

ClassParent
OnErrorOn
OnKeyOn
OnKeyLabelOn
OnShutDownOn

Workarea Helper Classes

These classes save, set, and restore the various aspects of saving the properties of work areas.

ClassParent
SaveSelectSaveArea
SetSelectSaveSelect
SaveBufferingSaveUsedArea
SetBufferingSaveBuffering
SaveRecnoSaveUsedArea
SaveOrderSaveUsedArea
SetOrderSaveOrder
SaveFilterSaveUsedArea
SetFilterSaveFilter
SaveRelationSaveUsedArea
SetRelationSaveRelation
SaveTableSaveUsedArea
SaveAllTablesCustom
OpenAliasCheckpointCustom

Miscellaneous Helper Classes

These classes save, set, and restore various other things.

ClassParentNotes
SavePropertyCustom
SetPropertySaveProperty
SetSysVarCustom
MessageTimerTimer
SetLockScreenCustomSaves and sets form.lockScreen, resetting it when the instance goes out of scope.
ScopeTimerCustomUpon destroy() debugout the object's scope lifetime in seconds..