VPMApp Class Methods

The following table lists the class methods. The methods listed include the standard Visual FoxPro class methods that the VPM Enterprise class uses and the VPM Enterprise custom methods. Where appropriate, the Comments column of the table describes a method and provides suggestions for its use.

 

Method

Comments

Standard Methods Used:

None

Custom Methods:

 

AddSecurity

Adds records to the security view cursor open in the Session object’s private data session.

Parameter: staAddSecurity

AdminTool_ActivityTracking

Adds a record to the Activity Tracking table.

Parameters: stcOption, stcDescription

AdminTool_ErrorHandling

The error handling routine called by the ON ERROR command that is issued in the IssueOnError method.

Displays a message if the Errors table is nearing the VFP maximum file size of two gigabytes.

Parameters: stnError, stcMethod, stnLine, stcClassOrProgram, stcMessage, stcCode

AdminTool_F1

Brings up the F1 Help window.

AdminTool_F2

Brings up the F2 Picklist form for the active control on the active form.

AdminTool_F3

Brings up the F3 Field Description form for the active control on the active form.

Parameters: stcKey, stlAltF3

AdminTool_FieldValidation

Called from the Valid event of controls, runs the AdminTool_FieldValidation method of the active form.

Parameters: stcDDDName, stcDDTVName, stcDDFName, stValue, stcRulesID, stcRefFilterExpr, staRefFilterVariables, stlRecordLevel, stcAlias

AdminTool_MCFSecurity

Performs the menu, control and field security checks.

Parameters: stcParam1, stcParam2, stcParam3

AdminTool_Status

Returns .T. if the specified administrative tool is turned on in the application. The tools’ IDs can be found in the SVPMAdminTools1 table.

Parameter: stcID

AdminTool_UserAccess

Calls the RunLoginForm method of the security object to run the Login form.

BypassErrorHandling_Start

There are two methods that allow for the temporary bypass of VPM error handling so that particular errors can be trapped at the point in the code where the error occurs. The BypassErrorHandling_Start method turns VPM error handling off. The BypassErrorHandling_Stop method turns VPM error handling back on. If the BypassErrorHandling_Start method is passed .T., any error that occurs before the BypassErrorHandling_Stop method is run will be logged in the Errors table. A common usage of these methods would be:

 

_SCREEN.oApp.BypassErrorHandling_Start()

<code that might cause error>

IF _SCREEN.oApp.BypassErrorHandling_Stop()

    <code to handle error>

ENDIF

 

Parameter: stlLogError

BypassErrorHandling_Stop

Turns off the bypassing of the normal error handling. Returns .T. if an error occurred while bypassing normal error handling.

Cleanup

Performs application cleanup activities, like releasing system and application forms and clearing menus, popups, windows, etc. This method is called when certain errors occur and when the application is exited.

Parameter: stlExitApp

Cleanup_ExitApplication

Performs the final cleanup activities necessary to exit the application.

ClearDLLFunctions

Clears the Dynamic-Link Library (DLL) functions used in the application.

CloseProjectManager

Makes sure that the VFP Project Manager is closed.

CreateFolder

Creates a new folder as well as any higher level folders that don’t exist.

Parameter: stcNewFolder

DefaultFolder

Returns the path of the default folder including the drive.

DefineFunctionKeys

Defines the function keys.

DeleteSecurity

Deletes records from the security view cursor open in the Session object’s private data session.

Parameters: stcDeleteType, stcUG, stcVariable

DisableF2F3

Disables the ON KEY LABEL commands for the F2, F3, and Alt+F3 keys.The ResetF2F3 method is run to re-issue those OKLs.

DisplayLogo

Displays the logo and copyright notice.

DisplayLogo_LabelWidth

Changes the width of the logo and copyright notice label controls based on the current string in the Caption property.

Parameter: stoLabel

ExitApplication

Called from the Exit menu option to begin the process of exiting the application. Prompts the user to determine if they really want to exit the application.

FolderExists

Determines if a folder exists.

Parameter: stcFolder

FormIsActive

Determines if the form specified in the parameter stcFormName is the currently active form. If no form name is passed, determines if a form is currently active.

Parameter: stcFormName

GetActiveForm

Places the object reference of the currently active form into the property oActiveForm. If this method returns a value of .T., the active form was found and can be referenced using the object reference in the oActiveForm property.

GetAPDRecord

Retrieves into an object (_SCREEN.oApp.oAPDRecord) the record in the SVPMApplicationDefinition.APD table. This allows the field values of the record to be available throughout the application the entire time the application is running (this method is run automatically at application startup). For example, the application/project prefix can be found in the following property: _SCREEN.oApp.oAPDRecord.cPrefix

GetDDD

Retrieves into an object (_SCREEN.oApp.oDDDRecord) the SDATADDD record (using the SCATTER NAME command) for the database or cursoradapter library specified in the parameters. Returns .T. if the record was found and the object was created.

Parameters: stcDDDName, stcPKValue

GetDDF

Retrieves into an object (_SCREEN.oApp.oDDFRecord) the SDATADDF record (using the SCATTER NAME command) for the field specified in the parameters. Returns .T. if the record was found and the object was created.

Parameters: stcDDDName, stcDDTVName, stcDDFName, stlFindLocal, stcPKValue, stcParentPKValue

GetDDF_FKNotInPK

Called by the RelatedForms_Init method of the Form_Toolbar class to load the 11th column of the Active Forms array (_SCREEN.oApp.aActiveForms) with information about the FK fields that are not in the PK of the cursor specified in the parameter stcDDTVGUID.

Parameter: stcDDTVGUID

GetDDIT

Retrieves into an object (_SCREEN.oApp.oDDITRecord) the SDATADDIT record (using the SCATTER NAME command) for the tag specified in the parameters. Returns .T. if the record was found and the object was created.

Parameters: stcDDDName, stcDDTVName, stcTag, stlFindLocal, stcPKValue, stcParentPKValue

GetDDTV

Retrieves into an object (_SCREEN.oApp.oDDTVRecord) the SDATADDTV record (using the SCATTER NAME command) for the table, view, or cursoradapter specified in the parameters. Returns .T. if the record was found and the object was created.

Parameters: stcDDDName, stcDDTVName, stlFindLocal, stcPKValue

GetFileAttributes

Returns as a string the attributes of the file whose name is passed to the method. The files path must be included if the file is located outside the VFP search path that is set.

Parameter: stcFile

GetMessageRecord

Retrieves into an object (_SCREEN.oApp.oMessageRecord) the SVPMMessages record (using the SCATTER NAME command) for the message specified in the parameter. If the record specified in the parameter cannot be found a default message is created that has as its Message ID the value of the parameter. Returns .T. if the record was found or created and the object was created.

Parameter: stcMessageID

GetSecRecord

Retrieves into an object (_SCREEN.oApp.oSecRecord) the SVPMSecurityData record (using the SCATTER NAME command) for the SEEK string in the parameter. Returns .T. if the record was found and the object was created.

Parameter: stcSeekString

InitializeProperties

Initializes the values in selected properties.

InitialLanguage

Prepares the application to use the initial language.

InstantiateApplicationToolbar

Instantiates the application toolbar (_SCREEN.oApp.oAppToolbar) from the class specified in the properties cAppToolbar and cAppToolbar_ClassLibrary.

InstantiateDataHandlerObject

Instantiates the data handling object (_SCREEN.oApp.oVPMDataHandler) for the application object’s private data session. The object is instantiated from the class specified in the property cDataHandlerClass.

InstantiateInternationalObject

Instantiates the international/multilingual object (_SCREEN.oApp.oInt) from the class specified in the property cInternationalClass.

InstantiateMessagingObject

Instantiates the messaging object (_SCREEN.oApp.oMessage) from the class specified in the property cMessagingClass.

InstantiateSecurityObject

Instantiates the security object (_SCREEN.oApp.oSec) from the class specified in the property cSecurityClass.

InstantiateSessionObject

Instantiates a Session object (_SCREEN.oApp.oSession) to create a private data session where tables and views can be opened.

InstantiateStartupToolbar

Instantiates the startup toolbar (_SCREEN.oApp.oStartupToolbar) from the class specified in the properties cStartupToolbar and cStartupToolbar_ClassLibrary.

IssueOnError

Invokes the application’s error handler.

Parameter: stnPass

IssueOnShutdown

Issues the application’s ON SHUTDOWN command.

LoadArray_AdminTools

Loads the Administrative Tools array _SCREEN.oApp.aTools.

LoadArray_ConditionBuilder

Called by the Condition Builder form to load an array with information about all of the fields in the table, view, or cursoradapter specified in the parameters.

Parameters: staFlds, stcDDDName, stcDDTVName

LoadArray_DriveSwapping

Loads the drive swapping array _SCREEN.oApp.aDrvSwap.

Parameter: stnPass

LoadArray_Find

Called by the Find form to load an array with information about all of the fields in the table, view, or cursoradapter specified in the parameters.

Parameters: staFlds, stcDDDName, stcDDTVName

LoadArray_Order

Called by the Order form to load an array with information about all of the tags for the table, view, or cursoradapter specified in the parameters.

Parameters: staTags, stcDDDName, stcDDTVName, stlChildOnly

LoadArray_ReindexPack

Called by the Reindex/Pack Tables form to load an array with information about all of the tables in the SDATADDTV table.

Parameter: staTVs

LoadArray_RelatedPages

Called by Related Pages forms to load an array with information about all of the fields in the table, view, or cursoradapter specified in the parameter stcGUID.

Parameters: staFlds, stcGUID

LoadArray_ReportSetupOptions

Called by the Report Setup Options form to load and array with information about all of the fields in the table, view, or cursoradapter specified in the parameters.

Parameters: staFlds, stcDDDName, stcDDTVName

LoadArray_ReportSetupOptionsAdd

Called by the Report Setup Options form to load an array with information about all of the tables, views, and cursoradapters in the SDATADDTV table.

Parameter: staTVs

LocalToRemote

For each local view in a DE, changes the CursorSource and Database properties to the name of the associated remote view and database that contains the remote view if specified in the DD. This method should be called from the BeforeOpenTables method of the DE of forms and reports that will use remote data. This method finds each view cursor in the DE and determines if the local or remote version of the view should be used. If the remote view should be used it changes the value in the CursorSource and Database properties of the cursor object to the name of the remote view and database that contains the remote view. The BeforeOpenTables method should contain the following code:

 

SET TALK OFF

SET DELETED ON

_SCREEN.oApp.LocalToRemote(This)

 

Parameter: stoDE

LoginLogout

Called by the Login and Logout menu options. If called by the Logout option, logs the current user out of the application. If called by the Login option, brings up the Login form so the user can log into the application.

MenuOption_SkipFor

Contains code called from the SkipFor expressions of the Edit and View menu options.

Parameters: stcOption, stVariableParam2, stVariableParam3, stVariableParam4

ModifyMainVFPWindow

Modifes the main VFP window’s properties.

OpenAtStartup_PDS

Opens the data dictionary, message, security, and multilingual view cursors that will remain open while the application is running. Leaving the cursors open will reduce network traffic and connection use. The cursors are opened in a private data session through the use of a Session object that was created in the InstantiateSessionObject method.

PerformExitAction

Performs the exit action (command) that is stored in the property cExitAction. This method is run at application exit and also when a “return to main menu” error occurs and the property lPerformExitActionOnError property is set to .T..

PerformStartupAction

Performs the startup action (command) that is stored in the property cStartupAction. This method is run at application startup and also when a “return to main menu” error occurs and the property lPerformStartupActionOnError property is set to .T..

PerformUserAccessSecurityCheck

Performs the User Access Security check, which includes running the Login form and setting the F3 and Alt+F3 OKLs.

RefreshMessages

Called by the Message Manager form to make sure that the messages view that is open in the application object’s private data session always contains the most current data.

RegisterAutomationServer

Registers the automation server whose name is passed to the method.

Parameters: stcServer, stlDLL

RegisterDLLFunctions

Registers the Dynamic-Link Library (DLL) functions used in the application.

ReleaseApplicationForms

Releases any application forms that might be active.

ReleaseApplicationToolbar

Releases the application toolbar.

ReleaseClassLib

Closes the class libraries opened by the application.

ReleaseDataHandlerObject

Releases the data handler object.

ReleaseInternationalObject

Releases the international/multilingual object.

ReleaseMessagingObject

Releases the messaging object.

ReleaseNavToolbar

Removes the toolbar whose name is stored in the cToolBar property of the active form.

ReleaseSecurityObject

Releases the security object.

ReleaseSessionObject

Releases the Session object and all objects that use the Session object’s private data session.

Reverts any unsaved changes that have been made to the cursors open in the Session object’s private data session (see OpenAtStartup_PDS method).

ReleaseStartupToolbar

Releases the startup toolbar.

ReleaseSystemWindows

Releases any VFP system windows that might be active.

ReleaseToolbars

Hides all VFP toolbars when an application is run.

RemoveFormFromActiveForms Array

Removes a form’s row from the array aActiveForms. Called by the ReleaseApplicationForms method of the application object and the Destroy event of forms.

RemoveLogo

Removes the logo and copyright notice control objects from the main VFP window.

ResetF2F3

Re-issues the ON KEY LABEL commands for the F2, F3, and Alt+F3 keys. This method is run after those OKLs are disabled by the DisableF2F3 method.

RestoreEnvironment

Restores certain environment settings that were in effect when the application was run.

RunAboutForm

Runs the About form.

RunActivityForm

Runs the Activity form.

RunAdminTool

Runs the method associated with the administrative tool that is identified in the stcID parameter that is passed to the method.

Parameters: stcID, stP1, stP2, stP3, stP4, stP5, stP6, stP7, stP8, stP9, stP10, stP11

RunAdminToolsForm

Runs the Admin Tools form.

RunAuditTrailForm

Runs the Audit Trail form.

RunDataManagerForm

Runs the Data Manager form.

RunDirectoriesForm

Runs the Directories form.

RunEnvironmentForm

Runs the Environment form.

RunErrorsForm

Runs the Errors form.

RunIntroductoryForm

Runs the Introductory form.

RunLoginForm

Runs the Login form.

RunMainMenu

Runs the application’s main menu.

RunMessageForm

Runs the Message form.

RunMessageManagerForm

Runs the Message Manager form.

RunMoverForm

Runs the Mover form. Returns .T. if the OK button was clicked on the form.

Parameters: stlMoverBars, stlNoSelectionOK, stcFormCaption, stcSourceLabel, stcDestLabel, stnListBoxWidth, stcMoverClass, stcMoverClass_ClassLibrary

RunObject

Runs the form or program whose name is passed to the method.

Parameters: stcObject, stcType, stP1, stP2, stP3, stP4, stP5, stP6, stP7, stP8, stP9, stP10

RunReindexPackTablesForm

Runs the Reindex/Pack Tables form.

RunReportManagerForm

Runs the Report Manager form (Run Only or Edit & Run) that is appropriate for the current user.

RunReportSetupForm

Runs the Report Setup form.

RunThermometerForm

Runs the Thermometer form.

RunTipForm

Runs the Tip of the Day form.

Parameter: stlFromHelp

SaveEnvironment

Saves certain environment settings so that they can be restored when the application is exited.

SetClassLib

Opens the class libraries that contain the class definitions that are used in the application.

SetEnvironment

Sets the environment for this application.

SetInitialEnvironment

Sets the initial environment.

SetPath

Determines the search path for this application. The path will include the application’s home directory and any subdirectories plus the directories listed on the Directories form.

SetToolbarControlProperties

Sets property values of the toolbar control whose object reference is passed to this method.

Parameters: stoControl, stnAction

ShortenPath

Shortens the path passed to this method.

Parameters: stcFullPath, stnLength

ShowForm

Called from options on the Window submenu to re-activate a form whose caption was added to the Window submenu.

Parameters: stcFormName, stnInstance

ShowNavToolbar

Instantiates the form toolbar for forms that use an external (standard) toolbar.

Parameters: stcToolbar, stcToolbar_ClassLibrary, stcFormName, stlBypassRefresh

ShowToolbars

Redisplays all VFP toolbars that were hidden at application startup.

SingleInstance

Prevents a second instance of this application from being launched if the property SingleInstance_lOnlyOneInstanceAllowed is set to .T. (the default).

SingleInstance_Cleanup

Releases the Mutex object.

SingleInstance_DisplayInstance

When the second instance of the application is launched, this method brings the first instance on top before the second instance is closed.

Startup

Performs application startup activities, like running the Login form, running the main menu, instantiating the application toolbar, performing the startup action, and instituting VFP event processing.

SwapDrive

Replaces the drive designator of the string that is passed to this program. The first character of the string is replaced.

Parameters: stcString, stcWhichWay

UpdateSecurity

Updates the records in the security view cursor open in the Session object’s private data session.

Parameters: stcUpdateType, stcUG, stcOldUserIDOrGroup, stcNewUserIDOrGroup

 

 

More:

Data Handler Class