Skip to content

peUpdateMode - cMonthCalendarPrompt

Determines the initialization and update mode that the calendar prompt 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 calendar prompt will be used. The mode can determine how the list will be initially seeded and how the date selection will be handled.

Posible values are:.

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

The default for a calendar prompt 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 calendar prompt is closed.

umPromptValue

If peUpdateMode is set to umPromptValue, the update will be local to the invoking object. The invoking object does not need to be a data entry object (DEO), but it must support the Value property. When invoked, the data from the invoking object will be moved to the calendar prompt and seeded. Upon selection, the selected date will be set to the invoking objects Value property.

This mode works well when the invoking object is a non-DEO, such as a Form and you need to make a date 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 pdSeedValue and pdSeedValue2.

Object oButton1 is a Button
    Set Location to 121 100
    Set Label to 'Change'

    Procedure Prompt_Callback Integer hoPrompt
        Date dDate
        Get Value of oDateTextBox to dDate
        Set peUpdateMode of hoPrompt to umPromptCustom
        Set pdSeedValue of hoPrompt to dDate
        Set phmPromptUpdateCallback of hoPrompt to (RefProc(DoDateUpdate))
    End_Procedure

    Procedure DoDateUpdate Integer hoSel Date dDate1 Date dDate2
        Set Value of oDateTextBox to dDate1
    End_Procedure

    Procedure OnClick
        Send Popup of oMonthCalendarPrompt
    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 data entry object (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 121 100
    Set Label to 'Change'

    Procedure DoDateUpdate Integer hoSel Date dDate1 Date dDate2
        Set Value of oDateTextBox to dDate1
    End_Procedure

    Procedure Prompt_Callback Integer hoPrompt
        Date dDate
        Get Value of oDateTextBox to dDate
        Set peUpdateMode of hoPrompt to umPromptCustom
        Set pdSeedValue of hoPrompt to dDate
        Set phmPromptUpdateCallback of hoPrompt to (RefProc(DoDateUpdate))
    End_Procedure

    Procedure OnClick
        Send Popup of oMonthCalendarPrompt
    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 pdSeedValue and pdSeedValue2 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 calendar prompt and an invoking object. This mode is typically used when you wish to create your own interface in your calendar prompt'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 calendar prompt 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.

For this, you will have to copy (perhaps using Save As) the predefined oMonthCalendarPrompt object in MonthCalendarPrompt.dg as your own custom version of the dialog. The

For the sample below, we will assume a custom object named oMyMonthCalendarPrompt object in MyMonthCalendarPrompt.dg. Also, oMyMonthCalendarPrompt cannot be a deferred object.

// This would be added to the calendar prompt's panel object.
Function GetSelectedDate Date dSeed Date ByRef dSelectedDate Returns Boolean
    Boolean bCancel

    Set peUpdateMode of oMyCalendar to umPromptNonInvoking
    Set pdSeedValue of oMyCalendar to dSeed

    Send Popup

    Get pbCanceled of oMyCalendar to bCancel
    If not bCancel Begin
        Get SelectedDate of oMyCalendar to dSelectedDate
        Function_Return bCancel
    End
    Function_Return bCancel
End_Function

And it could be called from any object as follows:

Use MyMonthCalendarPrompt.dg
:
Object oButton1 is a Button
    Set Location to 100 100

    Procedure OnClick
        Date dSeed dSelectedDate
        Boolean bCancel

        Get Value of oOrderHea_Order_Date to dSeed
        Get GetSelectedDate of oMyMonthCalendarPrompt dSeed (&dSelectedDate) to bCancel
        If not bCancel Begin
            // this works in a button added to Order.vw in the Order sample workspace
            // but you can use the returned value and do whatever else with it that you need
            Set Value of oOrderHea_Order_Date to dSelectedDate
        End
    End_Procedure
End_Object

The sample below does the same as the previous sample, but returns a date range (starting and ending date) instead of a single date from the calendar prompt.

// Properties to set for a date range
Object oMyCalendar is a cMonthCalendarPrompt
    Set pbMultiSelect to True
    Set peMouseSelectOk to msoDblClick
End_Object

// This would be added to the calendar prompt's panel object.
Function GetSelectedDate Date dSeed Date dSeed2 Date[] ByRef dSelectedDates Returns Boolean
    Boolean bCancel

    Set peUpdateMode of oMyCalendar to umPromptNonInvoking
    Set pdSeedValue of oMyCalendar to dSeed
    Set pdSeedValue2 of oMyCalendar to dSeed2

    Send Popup

    Get pbCanceled of oMyCalendar to bCancel
    If not bCancel Begin
        Get SelectedDateRange of oMyCalendar to dSelectedDates
        Function_Return bCancel
    End
    Function_Return bCancel
End_Function

And it could be called from any object as follows:

Use MyMonthCalendarPrompt.dg
:
Object oButton1 is a Button
    Set Location to 100 100

    Procedure OnClick
        Date dSeed
        Date[] dSelectedDates
        Boolean bCancel

        Get Value of oOrderHea_Order_Date to dSeed
        Get GetSelectedDate of oMyMonthCalendarPrompt dSeed 12/31/2016 (&dSelectedDates) to bCancel
        If not bCancel Begin
            Set Value of oOrderHea_Order_Date to dSelectedDates[1]
        End
End_Object