Use Windows.pkg

Object oChooseField is a ModalPanel
    Set Border_Style to Border_Thick
    Set Label to "Choose field"
    Set Location to 1 2
    // Visual DataFlex 14.0 Client Size Adjuster, modified May 7, 2008: 13:11:31
//    Set Size to 152 152
    Set Size to 130 145
    // Visual DataFlex 14.0 Client Size Adjuster, modified May 7, 2008: 13:11:31
//    Set piMaxSize to 294 152
    Set piMaxSize to 272 146
    // Visual DataFlex 14.0 Client Size Adjuster, modified May 7, 2008: 13:11:31
//    Set piMinSize to 152 152
    Set piMinSize to 130 141




    Object oFieldList is a List
        Set Size to 101 133
        Set Location to 4 6
        Set peAnchors to anAll


        On_Key kEnter Send keyAction of oOK_btn

        Procedure DoFillList
            Integer iAntalFelter iItem iField iListItem iFieldtype
            Integer iOldState iStartField
            String sFieldname
            Get dynamic_update_state to iOldState
            Set dynamic_update_state to False
            Send cursor_wait of cursor_control
            Send Delete_data
            Set piChoosedField to 0
            // Fill the list by sending Add_item
            Get pDataNumFields to iAntalFelter
            Get FirstFieldnumber to iStartField
            For iItem From iStartField to iAntalFelter
                Move iItem to iField
                Get String_value of aFilDef Item (iField * 4) to sFieldname
                Get integer_value of aFildef Item ((iField * 4) + 1) to iFieldType
                If (iFieldType <> DF_OVERLAP) Begin
                    Send Add_Item Msg_None sFieldname
                    Get item_count to iListItem
                    Decrement iListItem
                    Set aux_value Item iListItem to iField
                End
            Loop
            Send Sort_Items ascending
            Set dynamic_update_state to iOldState
            Send cursor_ready of cursor_control
        End_Procedure // DoFillList

        // Send DoFillList // message must be sent to fill the list

        //Procedure OnChange
        //    Integer iCurrent
        //
        //    Get Current_Item To iCurrent // item number of current item
        //End_Procedure // OnChange

    End_Object    // oFieldList

    Object oOK_btn is a Button
        Set Label to "&OK"
        Set Location to 112 15
        Set peAnchors to anBottomRight

        Procedure OnClick
            Integer iItem iField
            String sField
           Get current_item of oFieldList to iItem
           Get value of oFieldList Item iItem to sField
           Get aux_value of oFieldList Item iItem to iField
           Set piChoosedField to iField
           Set pValgtFelt to sField
           Send Close_Panel
        End_Procedure // OnClick

    End_Object    // oOK_btn

    Object oCancel_btn is a Button
        Set Label to "&Cancel"
        Set Location to 112 81
        Set peAnchors to anBottomRight

        Procedure OnClick
           Send Close_Panel
        End_Procedure // OnClick

    End_Object    // oCancel_btn



    On_Key kCancel Send close_panel

    Procedure Activate_group
        Set visible_state to False
        Forward Send Activate_group
        Set piChoosedField to -1
        Set pValgtFelt to ""
        Send DoFillList of oFieldList
        Set visible_state to True
    End_Procedure


End_Object    // oChooseField