Form_Toolbar_OneToMany Class Properties and Methods

Properties

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

Property & Initial Value

Comments

Standard Properties Used:

 

Caption = “Form_Toolbar_OneToMany”

 

Height = 351

 

Name = “form_toolbar_onetomany”

 

Width = 620

 

Custom Properties:

 

aFKFields[1,0] = .F.

Each row contains a comma-delimited list of FK fields for a child cursor. The field list for the child cursor displayed on page 1 of the child pageframe is stored in row 1, and so on.

cParentPKExpr = “”

Contains the PK expression of the parent cursor when using child views or cursoradapters. Used when determining the value that is used when repopulating the child cursors.

lAllowParentMode = .F.

Parent Mode must be turned off to prevent unwanted behavior.

lAskToCopyChildMessage = .T.

If .T., causes a message to be displayed prior to a parent record being copied. The message asks the user if they want to copy the child records along with the parent record.

lNewChildFromMenu = .F.

Used internally.

lOKToRepopulateChild = .F.

Used iternally by the AddNew method to make sure the child views and cursoradapters are repopulated when a new parent record is created.

lSaveNewParentOnNewChild = .F.

If .T. and the New button next to the child grid is clicked while the parent record is new, the parent record is saved before the new child record is created.

lTrans_Form_ = .F.

When using the multilingual functionality, the translation of properties needs to occur at the end of the Form_Toolbar_OneToMany.Init instead of at the end of the Form_.Init.

lTrans_Form_Toolbar = .F.

See comments for lTrans_Form_.

lTrans_Form_Toolbar_OTM = .T.

See comments for lTrans_Form_.

ParentPKValue = “”

Used internally to keep track of the last parent record PK value that was used to repopulate the child cursors. Its purpose is to have the child cursors repopulated only when necessary.

 

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:

 

Init

Makes the parent cursor the current cursor.

Loads the FK fields array aFKFields for each child cursor.

If using the multilingual functionality, translates the properties of the form and its objects.

Custom Methods:

 

AddNew

Makes sure that the child cursors are repopulated when a new parent record is added, so that the child grids are empty.

Child_Copy

Copies the current record in the child grid on the active page of the child pageframe.

Child_CopyWithParent

Copies the current parent record and related child records. Called by the Copy method of the Form_Toolbar class when the following are true:

The user clicks the Copy button to copy the parent record.

The property lCopyChildWithParent is set to .T..

The property lAskToCopyChildMessage is set to .F. or it is set to .T. and the user chooses “Yes” when prompted to copy the child records.

Child_Delete

Deletes the current record in the child grid on the active page of the child pageframe.

Child_New

Adds a record to the child grid on the active page of the child pageframe.

cmdCopy.Click

Runs the Child_Copy method.

cmdDelete.Click

Runs the Child_Delete method.

cmdNew.Click

Runs the Child_New method.

Delete

Makes sure that when a parent record is deleted, any new child records that had not been saved are also removed.

IdentifyDataChangedAliases

Returns a comma-delimited list of the aliases that should be saved and checked for changes. This includes the child cursors as well as the cursors identified in the cUpdateAliases property.

IsParent

Returns .T. if the parent cursor is not at end-of-file. Otherwise, returns .F..

RefreshForm

If child views or cursoradapters are used, this method will repopulate the child cursors so that only child records related to the current parent record are displayed in the child grids.

Parameter: stlNoChildRepopulate

RemoveRelations

Removes child table relations when the form is closed.

Restore

Cancels additions and changes to the parent cursor and child cursors. If the current child record is new or has been changed and there is another record that is new or has been changed, asks the user if they want to cancel changes to the current child record or cancel changes to all records in all cursors.

Parameter: stlCancel

Save

Saves the current record in the parent cursor and all modified records in the child cursors. Also saves records in additional cursors that are specified in the property cUpdateAliases.

 

 

More:

Form_Toolbar_RelatedPages Class Properties and Methods