Skip to content

Child_Entering - dbGrid_

Provided to permit programming of required grid actions when this object is a child of a header grid object

Type: Event
Return Data Type: Integer

Syntax

Function Child_Entering Returns Integer

Description

Child_Entering is a null function, provided to permit programming of required grid actions when this object is a child of a header grid object. This message is sent by entering when Child_Table_State is True, and should return 0 when entering is allowed.

Sample

Object oOrderEntryView is a dbView
    :
    // Change: Table entry checking - attempt to save header record
    //         before entering a table (this is called by table. Return
    //         a non-zero if the save failed (i.e., don't enter table)
    Function Save_Header Returns Integer
        Boolean bHasRec bChanged
        Handle hoSrvr

        Get Server to hoSrvr                 // The Header DDO.
        Get HasRecord of hoSrvr to bHasRec   // Do we have a record?
        Get Should_Save to bChanged          // Are there any current changes?

        // If there is no record and no changes we have an error.
        If ( not(bHasRec) and not(bChanged) ) Begin  // no rec
            Error DfErr_Operator 'You must First Create & Save Main Order Header'
            Function_Return 1
        End

        // Attempt to Save the current Record
        // request_save_no_clear does a save without clearing.
        Send Request_Save_No_Clear

        // The save succeeded if there are now no changes, and we
        // have a saved record. Should_save tells us if we've got changes.
        // We must check the data-sets hasRecord property to see if
        // we have a record. If it is not, we had no save.
        Get Should_Save to bChanged  // is a save still needed
        Get HasRecord of hoSrvr to bHasRec // current record of the DD
        // if no record or changes still exist, return an error code of 1
        If ( not(bHasRec) or (bChanged)) ;
            Function_Return 1
    End_Function  // Save_Header

    Object oOrderDtl_Grid is a dbGrid
        :
        // Called when entering the table. Check with the header if it
        // has a valid saved record. If not, disallow entry.
        Function Child_Entering Returns Integer
            Integer iRetVal
            // Check with header to see if it is saved.
            Delegate Get Save_Header to iRetVal
            Function_Return iRetVal // if non-zero do not enter
        End_Function  // Child_Entering

Return Value

Returns 0 when entering is allowed