//AB/ Project ColumnProperties
//AB/ Object prj is a Dialog_Project
    //AB/ Set Size to 158 333
    //AB/ Set ProjectName to "ColumnProperties"
    //AB/ Set ProjectFileName to "ColumnProps.dg"
    //AB/ Set GenerateFileName to "NONAME"

// Project Object Structure
//   oColumnProps is a ModalPanel
//     oName is a Form
//     oType is a ComboForm
//     oLength is a Form
//     oPrecision is a Form
//     oOffset is a Form
//     oOK_btn is a Button
//     oCancel_btn is a Button
//     oDelete is a Button
//     oNew is a Button

// Register all objects
Register_Object oCancel_btn
Register_Object oColumnProps
Register_Object oDelete
Register_Object oLength
Register_Object oName
Register_Object oNew
Register_Object oOffset
Register_Object oOK_btn
Register_Object oPrecision
Register_Object oType

//AB-IgnoreStart
Use Windows.pkg
Use dfCmbFrm.pkg
//AB-IgnoreEnd



Object oColumnProps is a ModalPanel

    //AB-StoreTopStart
    Enum_List
        Define COLUMNPROPS_CANCEL
        Define COLUMNPROPS_OK
        Define COLUMNPROPS_NEW
        Define COLUMNPROPS_DELETE
    End_Enum_List
    
    Property Integer piSelectedFunction
    
    //AB-StoreTopEnd

    Set Border_Style to Border_Thick
    Set Label to "Column properties"
    Set Location to 2 2
    Set Size to 132 277
    Set piMinSize to 104 217

    //AB-DDOStart


    //AB-DDOEnd

    Object oName is a Form
        Set Label to "Name:"
        Set Size to 13 85
        Set Location to 5 70
        Set Capslock_State to TRUE

        //AB-StoreStart
        //OnChange is called on every changed character
        //Procedure OnChange
        //    String sValue
        //
        //    Get Value To sValue
        //End_Procedure // OnChange
        //AB-StoreEnd

    End_Object    // oName

    Object oType is a ComboForm
        Set Label to "Type:"
        Set Size to 13 85
        Set Location to 23 70
        Set Form_Border to 0
        Set Entry_State Item 0 to FALSE
        Set Combo_Sort_State to FALSE

        //AB-StoreStart
        //Class is defined in dfCmbFrm.pkg
        
        //Combo_Fill_List is called when the list needs filling
        Procedure Combo_Fill_List
            // Fill the combo list with Send Combo_Add_Item
            Send Combo_Add_Item "ASCII"
            Send Combo_Add_Item "NUMERIC"
            Send Combo_Add_Item "DATE"
            Send Combo_Add_Item "OVERLAP"
            Send Combo_Add_Item "TEXT"
            Send Combo_Add_Item "BINARY"
        End_Procedure // Combo_Fill_List
        
        //OnChange is called on every changed character
        Procedure OnChange
            String sValue
        
            Get Value to sValue // the current selected item
            Set Enabled_state of oOffset to (sValue = "OVERLAP")
            Set Enabled_state of oPrecision to (sValue = "NUMERIC")
            Set Enabled_state of oLength to (sValue <> "DATE")
        
        End_Procedure // OnChange
        
        //Notification that the list has dropped down
        //Procedure OnDropDown
        //End_Procedure // OnDropDown
        
        //Notification that the list was closed
        //Procedure OnCloseUp
        //End_Procedure // OnCloseUp
        //AB-StoreEnd

    End_Object    // oType

    Object oLength is a Form
        Set Label to "Length:"
        Set Size to 13 56
        Set Location to 41 70
        Set Form_DataType to ascii_window

        //AB-StoreStart
        //OnChange is called on every changed character
        //Procedure OnChange
        //    String sValue
        //
        //    Get Value To sValue
        //End_Procedure // OnChange
        
        
        //AB-StoreEnd

    End_Object    // oLength

    Object oPrecision is a Form
        Set Label to "Precision:"
        Set Size to 13 56
        Set Location to 58 70
        Set Form_DataType to ascii_window

        //AB-StoreStart
        //OnChange is called on every changed character
        //Procedure OnChange
        //    String sValue
        //
        //    Get Value To sValue
        //End_Procedure // OnChange
        
        
        //AB-StoreEnd

    End_Object    // oPrecision

    Object oOffset is a Form
        Set Label to "Offset:"
        Set Size to 13 56
        Set Location to 76 70
        Set Form_DataType to ascii_window

        //AB-StoreStart
        //OnChange is called on every changed character
        //Procedure OnChange
        //    String sValue
        //
        //    Get Value To sValue
        //End_Procedure // OnChange
        //AB-StoreEnd

    End_Object    // oOffset

    Object oOK_btn is a Button
        Set Label to "&OK"
        Set Size to 14 63
        Set Location to 97 138
        Set peAnchors to anBottomRight

        //AB-StoreStart
        Procedure OnClick
            Set piSelectedFunction to COLUMNPROPS_OK
            Send Close_Panel
        End_Procedure // OnClick
        //AB-StoreEnd

    End_Object    // oOK_btn

    Object oCancel_btn is a Button
        Set Label to "&Cancel"
        Set Size to 14 63
        Set Location to 97 205
        Set peAnchors to anBottomRight

        //AB-StoreStart
        Procedure OnClick
            Set piSelectedFunction to COLUMNPROPS_CANCEL
            Send Close_Panel
        End_Procedure // OnClick
        //AB-StoreEnd

    End_Object    // oCancel_btn

    Object oDelete is a Button
        Set Label to "Delete column"
        Set Size to 14 63
        Set Location to 97 71

        //AB-StoreStart
        // fires when the button is clicked
        Procedure OnClick
            Integer iSvar
            Get yesno_box ("This will delete the current column!\n\nAre you sure?") "WARNING!" MB_DEFBUTTON2 to iSvar
            If (iSvar <> MBR_YES) Procedure_Return
            Set piSelectedFunction to COLUMNPROPS_DELETE
            Send Close_Panel
        End_Procedure // OnClick
        //AB-StoreEnd

    End_Object    // oDelete

    Object oNew is a Button
        Set Label to "As new column"
        Set Size to 14 63
        Set Location to 97 4

        //AB-StoreStart
        // fires when the button is clicked
        Procedure OnClick
            Set piSelectedFunction to COLUMNPROPS_NEW
            Send Close_Panel
        End_Procedure // OnClick
        //AB-StoreEnd

    End_Object    // oNew


    //AB-StoreStart
                
    Procedure Popup
        Set piSelectedFunction to COLUMNPROPS_CANCEL
        Forward Send Popup
    End_Procedure
    //AB-StoreEnd

End_Object    // oColumnProps


//AB-StoreStart

//AB-StoreEnd

//AB/ End_Object    // prj