OnStoreDefaults - cDbCJGridPromptList
Stores the default values of properties that are likely to be changed during a popup instance. These are restored in OnRestoreDefaults.
Type: Event
Syntax
Procedure OnStoreDefaults
Description
The OnStoreDefaults and OnRestoreDefaults events provide a mechanism for changing prompt list properties upon activation and then to restore these properties back to their defaults upon activation. This makes it easy to customize the behavior of a prompt list based on the object that invokes it, which makes it possible to reuse the same prompt list for a variety of purposes.
When a prompt list is activated, it sends the OnStoreDefaults event, which stores a copy of all of the properties you might change. It then sends the event Prompt_Callback to the invoking object. After the prompt list is deactivated, it sends the OnRestoreDefaults event, which restores the properties back to the original values. Therefore, you can make property changes within Prompt_Callback knowing that the default values will be restored upon deactivation.
The following properties are stored and restored within OnStoreDefaults and OnRestoreDefaults:
pbAutoSeed pbAutoServer pbAutoOrdering pbAutoSearch pbAutoEnableColumns pbMultipleSelection pbSelectionEnable pbStaticData peUpdateMode piUpdateColumn piInitialColumn phmPromptUpdateCallback phmPromptSeedBufferCallback Ordering Server
If you need to preserve other custom properties within your object or subclass, you may do so by creating the storage property for it and augmenting OnStoreDefaults and OnRestoreDefaults. These two methods should always be mirrors of each other.
Class cMyPromptList is a cDbCJGridPromptList
Procedure Construct_Object
Forward Send Construct_Object
Property Boolean pbMyCustomProperty
Property Boolean pbStoredMyCustomProperty
End_Procedure
Procedure OnStoreDefaults
Boolean bState
Forward Send OnStoreDefaults
Get pbMyCustomProperty To bState
Set pbStoredMyCustomProperty to bState
End_Procedure
Procedure OnRestoreDefaults
Boolean bState
Forward Send OnRestoreDefaults
Get pbStoredMyCustomProperty To bState
Set pbMyCustomProperty to bState
End_Procedure
End_Class
When used with invoking object update modes (peUpdateMode is umPromptRelational, umPromptValue or umPromptCustom), the sending of OnStoreDefaults and OnRestoreDefaults is automatic and you will never need to send these messages.
If your update mode is non-invoking (peUpdateMode is umPromptNonInvoking), these events are not sent, because there is no invoking object to send Prompt_Callback to. When used in a non-invoking mode, you can choose to send these messages yourself. If you do this, you should send OnStoreDefaults before you change any properties and then send OnRestoreDefaults after the prompt popup us complete.
// This would be added to the prompt list's panel object.
Function GetSelectedName String sSeed String ByRef sName Returns Boolean
Boolean bCancel
String[] SelectionValues
Send OnStoreDefaults of oSelList
Set peUpdateMode of oSelList to umPromptNonInvoking
Set piUpdateColumn of oSelList to 1
Set psSeedValue of oSelList to sSeed
Send Popup
Send OnRestoreDefaults of oSelList
Get pbCanceled of oSelList to bCancel
If not bCancel Begin
Get SelectedColumnValues of oSelList 1 to SelectionValues
If (SizeOfArray(SelectionValues)) Begin
Move SelectionValues[0] to sName
Function_Return True
End
End
Function_Return False
End_Function