The Onform_Toolbar class is actually not a control class. It’s a container class that contains CommandButtons for each of the toolbar controls. The Onform_Toolbar class allows you to place the Form Toolbar controls directly on a form.
By default a form you create based on the Form_Toolbar class uses the external VPM Enterprise toolbar.
If you want to create a form that puts the toolbar controls directly on the form, do the following:
· Create the form based on the Form_Toolbar class or any of its subclasses.
· In the Visual FoxPro Form Designer, make room on the form for the On-Form Toolbar.
· Make sure that the controls in either the VPMCTRLS.VCX or PROCTRLS.VCX is displayed on the Visual FoxPro Controls Toolbar. Select the OnForm_Toolbar container class on the Controls Toolbar and add it to the form.
· Remove the default “toolbar_all” entry in the form’s cToolbar property.
· You can then modify the On-Form Toolbar just like the external toolbar.
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: |
|
|
BackStyle = 0 |
|
|
BorderWidth = 0 |
|
|
Height = 22 |
|
|
Name = “onform_toolbar” |
|
|
Width = 432 |
|
|
Custom Properties: |
|
|
i_cUse_ID = “” |
A two-character ID used by the multilingual functionality to provide for the unique translation of a control’s properties. |
|
lListGrid = .F. |
The When method of each button sets the property lListGrid to .T. if the active control is a List Grid. Used by the ActivateFirst method. |
|
lUpdateAllow = .T. |
Used internally to make sure the Refresh method of the toolbar enables/disables the toolbar buttons at the appropriate time. |
|
nSpecialEffect = 2 |
In the Init event the setting of this property is transferred to the SpecialEffect property of the controls that are on the toolbar. |
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 |
Fills-in the form’s oOnFormContainer property that holds the object reference of the toolbar container. The setting of the nSpecialEffect property is transferred to the SpecialEffect property of the controls that are on the toolbar. |
|
Refresh |
Makes sure the active cursor is selected. Checks the Control Security for each control on the toolbar and sets the “lAllow” properties in the form. The form’s RFParentValue property will not be empty if there is a Related Forms situation in which the form’s cursor is the child of another form’s cursor. Determines if currently in Parent Mode. Determines if at end-of-file or beginning-of-file. Determines if the current record is the first or last record. Updates the toolbar button properties, enabling and disabling the buttons. |
|
Custom Methods: |
|
|
ActivateFirst |
If the active control is a List Grid when one of the toolbar buttons is clicked, activates the page specified in the nSetFocusToFirst property. |
|
DisableControls |
When in the “add mode”, disables all buttons except the Save, Restore and More. |
|
GridListDisable |
If the current control is a Grid List, disables certain controls. |
|
SetFocusToGrid |
Called by the Click method of toolbar buttons. If editing through a grid, places the focus back on the grid so that the current record can be easily identified. |
|
Toolbar Button Click Methods: |
|
|
cmdParent.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Toggles the lRFParentMode form property signifying the Parent Mode on/off status. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdFind.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s Find method that brings up either the Find form or the SQL Find form. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdLocate.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s Locate method that brings up the Locate (Condition Builder) form. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdList.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s List method that brings up the List form. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdFilter.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s Filter method that brings up the Filter (Condition Builder) form. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdOrder.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s Order method that brings up the Order form. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdPrint.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s Print_Toolbar method that brings up the Report Manager, runs a command, or runs a report or label. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdFirst.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s First method that moves the record pointer to the first record in the cursor. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdPrior.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s Prior method that moves the record pointer to the prior record in the cursor. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdNext.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s Next method that moves the record pointer to the next record in the cursor. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdLast.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s Last method that moves the record pointer to the last record in the cursor. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdNew.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s AddNew method that adds a record to the cursor. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) DisableControls method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. |
|
cmdCopy.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s Copy method that copies the current record. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) DisableControls method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. |
|
cmdDelete.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s Delete method that deletes the current record. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdGroupDelete.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s GroupDelete method that brings up the Filter (Condition Builder) form before deleting records that match the specified criteria. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdMore.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s Save and AddNew methods to save the current record and then add a new record. If the new record is added: Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) DisableControls method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. If the new record is not added: Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the form’s RefreshForm method to redisplay the previous record, the one that was saved. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdSave.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s Save method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the form’s RefreshForm method to redisplay the saved record. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdRestore.Click |
Runs the toolbar’s (container’s) ActivateFirst method. Runs the form’s Restore method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) Refresh method. Runs the form’s EnableDisableToolbarControls method so toolbar controls can be conditionally enabled and disabled. Runs the toolbar’s (container’s) SetFocusToGrid method. |
|
cmdClose.Click |
Runs the form’s QueryUnload method. If the QueryUnload method returns .T., runs the form’s Release method to close the form. |
Onform_Toolbar_Edit Class Properties and Methods