Skip to content

peUpdateMode - cCJGridPromptList

Determines the initialization and update mode that the prompt list uses

Type: Property
Access: Read/Write
Data Type: Integer
Parameters: None

Syntax

Property Integer peUpdateMode
Access Type Syntax
Read Access: Get peUpdateMode to IntegerVariable
Write Access: Set peUpdateMode to IntegerVariable/Value

Description

peUpdateMode determines how the prompt list will be used. The mode can determine how the list will be initially seeded, what the initial column and ordering will be and how the selection will be handled.

Posible values are:.

Constant Meaning
umPromptValue The prompt list is used to update the Value property of the invoking object.
umPromptCustom The prompt list has an invoking object but there is no automatic update of selected data.
umPromptNonInvoking The prompt list has no invoking object and no automatic update.

The default for a prompt list is umPromptValue. If this default is changed, it is often changed temporarily within the invoking object's Prompt_Callback event. If changed within Prompt_Callback, the original mode (probably umPromptValue) will be restored when prompt list is closed.

umPromptValue

If peUpdateMode is set to umPromptValue, the update will be local to the invoking object and the prompt list's piUpdateColumn property. The invoking object does not need to be a DEO, but it must support the Value property. When invoked, the data from the invoking object will be moved to the prompt list and seeded based on the binding and ordering of piUpdateColumn. Upon selection, the value from the selected row's piUpdateColumn will be set to the invoking object's Value property.

This mode works well when the invoking object is a non-DEO, such as a Form and you need to make a selection for starting a process, such as a report.

Typically, this mode is set inside of the invoking object's Prompt_CallBack event. You will usually set this property and set piUpdateColumn.

Object oStartCustNumber is a Form
    Set Label to "Customer Number:"
    Set Size to 13 85
    Set Location to 10 92
    Set Form_DataType to 0
    Set Prompt_Button_Mode to pb_PromptOn

    //  The following code connects the customer selection list to this form  
    Set Prompt_Object to Customer_sl

    // this forces a simple value update for column 0
    Procedure Prompt_Callback Integer hPrompt
          Set peUpdateMode of hPrompt to umPromptValue
          Set piUpdateColumn of hPrompt to 0
    End_Procedure

End_Object

umPromptCustom

If peUpdateMode is set to umPromptCustom, the update will still expect an invoking object, but the seeding and update process must be manually coded. The invoking object can be an object that understands the Prompt event. It does not need to be a DEO and it does not need to support the Value property.

Typically, this mode is set inside of the invoking object's Prompt_CallBack event.

Object oButton1 is a Button
    Set Location to 100 100

    Procedure PromptUpdate Handle hoPrompt
        String[] SelectedNames                    
        Get SelectedColumnValues of hoPrompt 1 to SelectedNames
        If (SizeOfArray(SelectedNames)) Begin
            Set Value of oMyStartForm to SelectedNames[0]
        End
    End_Procedure   

    Procedure Prompt_Callback Integer hPrompt
        String sValue

        Set peUpdateMode of hPrompt to umPromptCustom
        Set piUpdateColumn of hPrompt to 1 // on name column
        Set phmPromptUpdateCallback of hPrompt to (RefProc(PromptUpdate))
        Get Value of oMyStartForm to sValue
        Set psSeedValue of hPrompt to sValue
    End_Procedure

    Procedure OnClick
        Send Popup of  Customer_sl
    End_Procedure

End_Object

When using this mode, you can create your own update callback by setting the phmPromptUpdateCallback message. In addition, you will usually set the piUpdateColumn and psSeedValue properties to seed the list.

umPromptNonInvoking

If peUpdateMode is set to umPromptNonInvoking, there is no invoking object at all and therefore, there can be no communication between the prompt list and an invoking object. This mode is typically used when you wish to create your own interface in your prompt list's modal panel container. Instead of sending Popup to this object, you send a custom message which manages the entire process. While using this mode requires extra work, it is the most flexible of the non-relational approaches because the prompt list panel controls the entire process and objects using this need know nothing about how the list is configured. The invoking object simply uses a predefined interface that passes and returns data.

Also, the modal panel cannot be a deferred object.

// This would be added to the prompt list's panel object.
Function GetSelectedName String sSeed String ByRef sName Returns Boolean
    Boolean bCancel
    String[] SelectionValues

     // with non-invoking lists we store and restore the defaults manually
    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

And it could be called from any object as follows:

Object oButton1 is a Button
    Set Location to 100 100

    Procedure OnClick
        String sName sSeed
        Boolean bCancel

        Get Value of oMyStartForm to sSeed
        Get GetSelectedName of  Customer_sl sSeed (&sName) to bCancel
        If not bCancel Begin
            Set Value of oMyStartForm to sName
        End
    End_Procedure
End_Object