Form_Toolbar_RelatedPages 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_RelatedPages”

 

Height = 310

 

Name = “form_toolbar_relatedpages”

 

Width = 510

 

Custom Properties:

 

aRelatedPgf[1,26]

Contains information about the tables edited on the Related Pages pageframe, with each row holding the information about the table edited on the corresponding page.

lFirstActivate = .T.

The array aRelatedPgf is loaded in the Activate method and lFirstActivate is used to make sure it is only loaded the first time the Activate method is run.

lRelatedPagesWithViewsAnd Cas = .F.

Is set to .T. by the Related Pages form builder if the form is editing view cursors.

lSwitchPagesWithout

RefreshingToolbar = .F.

When .T., and the user is switching between two pages that edit the same cursor, the toolbar is not refreshed, which means that the toolbar buttons are enabled/disabled identically for both pages.

lSwitchPagesWithoutSaving = .T.

When .T., and the user is switching between two pages that edit the same cursor, the user will not be prompted to save changes.

lTrans_Form_ = .F.

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

lTrans_Form_Toolbar = .T.

See comments for lTrans_Form_.

nCurrentPage = 1

Contains the number of the currently active page.

 

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:

 

Activate

Calls either the Load_aRelatedPgf_ViewsAndCAs method or the Load_aRelatedPgf_Tables method depending on the type of child, grandchild, etc. cursors that will be displayed/edited.

Init

If the form’s cInitialSelectedAlias property is empty, determines the form’s ISA and places the alias name in the property.

Custom Methods:

 

IsParentEOF

Is called whenever a page is activated to disable the New and More toolbar buttons if the parent cursor is at EOF. Code can be added to this method to handle situations where the default functionality is not wanted. For example, in the sample application’s Related Pages forms, the form’s ISA cursor is displayed on both the first and second pages. By default, the New and More buttons would be enabled for these pages. However, to not allow a record to be added when the second page is active, the following code is added to the IsParentEOF method:

DODEFAULT()

IF ThisForm.pgfRelated.ActivePage = 2

   ThisForm.lAllowNew = .F.

   ThisForm.lAllowMore = .F.

ENDIF

This method returns .T. if the parent is at EOF. Otherwise it returns .F..

Load_aRelatedPgf_Tables

Run from the Activate method, loads the aRelatedPgf array if the form is editing tables, including the creation of a default toolbar List definition for each child cursor that is derived from the master tag expression.

Load_aRelatedPgf_ViewsAndCAs

Run from the Activate method, loads the aRelatedPgf array if the form is editing view or cursoradapter cursors, including the creation of a default toolbar List definition for each child cursor that is derived from the master tag expression.

LoadArray_RelatedPages

Called by the Load_aRelatedPgf_ViewsAndCAs and Load_aRelatedPgf_Tables methods. Loads the array whose reference is passes to this method with information about all of the fields in the table, view, or cursoradapter specified in the parameter stcGUID.

Parameters: staFlds, stcGUID

pgfRelated.Click

If changes were made on the previously active page, asks the user if they would like to save the changes (if lSwitchPagesWithoutSaving is .F.). Performs the save of the record.

Selects the cursor edited on the newly active page.

Moves values from the array aRelatedPgf to form properties for the newly active page.

Enables/disables the toolbar buttons as appropriate for the cursor edited on the newly active page.

When editing tables, runs the UpdatePages method to refresh the controls on each page.

RelatedForms_

SavePosition

Saves the record number of the ISA cursor in this form’s row in the Active Forms array. This information is used when this form is reactivated, a Related Form is activated or a Related Form is reactivated.

RemoveRelations

Removes the table relations when the form is closed.

RepopulateCursors

Repopulates the child cursors so that only child records related to the current parent record are displayed.

Select_Active

Selects the cursor used by the currently active page.

UpdatePages

Refreshes the controls on each page. Used when editing tables, not views or cursoradapters.

Related Pages Array

The Activate method of the Form_Toolbar_RelatedPages class runs the Load_aRelatedPgf_Tables method if the form is editing tables, not view or cursoradapter cursors. The Activate method runs the Load_aRelatedPgf_ViewsAndCAs method if the form is editing view or cursoradapter cursors, not tables. These methods contain code that loads the Related Pages array with information pertaining to each page in the pageframe. The first row pertains to the left-most page of the pageframe, the second row pertains to the second page (from the left) of the pageframe, and so on.

 

Column

Contents

 

For ISA Pages:

1

.T. – Identifies the page as an ISA page.

2

If this form is a Related Forms child form, contains the alias (ISA) of the parent cursor on the Related Forms parent form. The alias is placed in the cRFParentAlias property when this page is active.

3

Not used.

4

If this form is a Related Forms child form, contains a comma-delimited list of the PK fields in the parent cursor on the Related Forms parent form. The fields list is placed in the cRFParentPKFlds property when this page is active.

5

If this form is a Related Forms child form, contains the PK value of the current record in the parent cursor on the Related Forms parent form.

6

Contains the alias of the cursor edited on the page.

7

Contains the FK expression of the tag specified in column 9. The expression is placed in the cRFForeignKeyExpr property when this page is active.

8

Contains a comma-delimited list of the fields in the tag specified in column 7. The fields list is placed in the cRFForeignKeyFlds property when this page is active.

9

If this form is a Related Forms child form, contains the name of the FK Tag specified in the RI set up for the FK field in this page’s cursor that relates this page’s cursor to the parent cursor on the Related Forms parent form. The tag name is placed in the cRFForeignKeyTag property when this page is active.

10

Contains the value to be placed in the cListCaptions property when this page is active.

11

Contains the value to be placed in the cListFields property when this page is active.

12

Contains the value to be placed in the cListTags property when this page is active.

13

If this form is a Related Forms child form, contains the number of the parent form’s row in the Active Forms array. This number is placed in the nParentFormRow property when this page is active.

14

Contains the value to be placed in the lAllowParentMode property when this page is active.

15

Contains the value to be placed in the lRFParentMode property when this page is active.

16

Contains the value to be placed in the lAllowFilter property when this page is active.

17

Contains the value to be placed in the lAllowOrder property when this page is active.

18

Contains the value to be placed in the lBlankOutPKFlds property when this page is active.

19

Contains the value to be placed in the cListFields_Alt property when this page is active.

20

Contains the value to be placed in the lEditableGrid property when this page is active.

21

Contains the value to be placed in the nSetFocusToFirst_Page property when this page is active.

22

Not used.

23

Not used.

24

Contains the value to be placed in the nSetFocusToFirst_EditPage property when this page is active.

25

Not used.

26

Not used.

 

For Non-ISA Pages:

1

.F. – Identifies the page as a non-ISA page.

2

If this page edits a table, view, or cursoradapter, contains the alias of the parent cursor of this page’s cursor. The alias is placed in the cRFParentAlias property when this page is active.

3

If this page edits a table, contains the expression of the relation that is set between this page’s table and its parent table.

If this page edits a view or cursoradapter, contains the parent cursor’s PK Tag expression.

4

If this page edits a table, this column is not used.

If this page edits a view or cursoradapter, contains a comma-delimited list of the fields in the expression specified in column 3. The fields list is placed in the cRFParentPKFlds property when this page is active.

5

Not used.

6

Contains the alias of the cursor edited on the page.

7

Contains the FK expression of the tag specified in column 9. The expression is placed in the cRFForeignKeyExpr property when this page is active.

8

Contains a comma-delimited list of the fields in the tag specified in column 7. The fields list is placed in the cRFForeignKeyFlds property when this page is active.

9

Contains the name of the FK Tag specified in the RI set up for the FK field in this page’s cursor that relates this page’s cursor to its parent cursor on one of the other pages. The tag name is placed in the cRFForeignKeyTag property when this page is active.

10

Contains the value to be placed in the cListCaptions property when this page is active.

11

Contains the value to be placed in the cListFields property when this page is active.

12

Contains the value to be placed in the cListTags property when this page is active.

13

Contains the number 1, which is placed in the nParentFormRow property when this page is active.

14

Contains the false (.F.) value, which is placed in the lAllowParentMode property when this page is active.

15

Contains the false (.F.) value, which is placed in the lRFParentMode property when this page is active.

16

Contains the false (.F.) value, which is placed in the lAllowFilter property when this page is active.

17

Contains the false (.F.) value, which is placed in the lAllowOrder property when this page is active.

18

Contains the false (.F.) value, which is placed in the lBlankOutPKFlds property when this page is active.

19

Contains the null string, which is placed in the cListFields_Alt property when this page is active.

20

Contains the value to be placed in the lEditableGrid property when this page is active.

21

Contains the number 0 (zero), which is placed in the nSetFocusToFirst_Page property when this page is active.

22

For a view or cursoradapter, contains the PK value of the view or cursoradapter’s SDATADDTV record.

23

For a local view, contains the PK value of the source table’s SDATADDTV record.

24

Contains the number 0 (zero), which is placed in the nSetFocusToFirst_EditPage property when this page is active.

25

For a view or cursoradapter, contains the name of the database or cursoradapter library that contains the view or cursoradapter, respectively.

26

For a view or cursoradapter, contains the name of the view or cursoradapter.

 

More:

Toolbar Classes