Use Dfclient.pkg

Object Brug_Filelist is a dbModalPanel

    Property String psValgtReg ""

    Set Label to "Choose databasefile from filelist.cfg"
    Set Location to 4 4
    Set Size to 133 295

    Object oSellist is a List



        Set Size to 101 285
        Set Location to 4 4
        Set peAnchors to anAll


        Procedure DoFillList
            String Rootname Besked Displayname Logicalname sStinavn sPhysicalName
            Integer Filenum iMaxRec iNumRec StructHandle iNyMaxRec
            Integer maxFilelist iOldStd
            Boolean bDisplayFile
            Get dynamic_update_state to iOldStd
            Set dynamic_update_state to False

            Send Delete_Data
            Send Delete_Data to oFilelistSti

            Move 0 to maxFilelist
            Move 0 to Filenum   //Start at top of current filelist
            Repeat
                Get_Attribute DF_FILE_NEXT_USED of FileNum to FileNum
                If Filenum Begin
                    Get_Attribute DF_FILE_ROOT_NAME of FileNum to Rootname
                    Get_Attribute DF_FILE_DISPLAY_NAME of FileNum to Displayname
                    If (Uppercase(Trim(Rootname)) <> "FLEXERRS") Begin
                        Move Filenum to besked
                        Append besked ", " Displayname ", " Rootname
                        Send Add_item 0 besked
                        Set array_value of oFilelistSti Item maxFilelist to FileNum
                        Increment maxFilelist
                    End
                End
            Until (FileNum = 0)
            Set dynamic_update_state to iOldStd

        End_Procedure  // DoFillList

        //Procedure OnChange
        //    Integer iCurrent
        //    Get Current_item to iCurrent // item number of current item
        //
        //End_Procedure  // OnChange

        Procedure Ok
            String sValgt
            Integer iItem Filenum
            Get current_item to iItem
            Get Integer_value of oFilelistSti Item iItem to FileNum
            Send ignore_all to error_info_object
            Open FileNum
            If (Found) Begin     //Det lykkedes at †bne filen
                Get_Attribute DF_FILE_ROOT_NAME of Filenum to sValgt
                If (sValgt = "") Begin
                    Get_Attribute DF_FILE_PHYSICAL_NAME of FileNum to sValgt
                End
            End
            Else Begin
                Move "" to sValgt
            End
            Close FileNum
            Send trap_all to error_info_object
            If (sValgt = "") Send info_box "Cannot open this databasefile."
            Else Begin
                Set psValgtReg to sValgt
                Set piFileNumber to FileNum
                Send Request_cancel
            End
        End_Procedure

        Procedure Cancel
            Send Request_cancel
        End_Procedure

        Procedure Mouse_click Integer iW Integer iP
            Forward Send Mouse_click iW iP
            Send Ok
        End_Procedure


    End_Object    // oSellist

    Object oOK_bn is a Button
        Set Label to "&Ok"
        Set Location to 114 181
        Set peAnchors to anBottomRight

        Procedure OnClick
            Send OK to oSelList
        End_Procedure

    End_Object    // oOK_bn

    Object oAnnuller_bn is a Button
        Set Label to "&Cancel"
        Set Location to 114 235
        Set peAnchors to anBottomRight

        Procedure OnClick
            Send Cancel to oSelList
        End_Procedure

    End_Object    // oAnnuller_bn

    Object oFilelistSti is a Array
    End_Object    // oFilelistSti



    On_Key Key_Alt+Key_O Send KeyAction to oOk_bn
    On_Key Key_Alt+Key_C Send KeyAction to oAnnuller_bn
    On_Key key_escape Send Cancel of oSellist
    On_Key kEnter Send Ok of oSellist

    Procedure Activate_group
        Set visible_state to False
        Forward Send Activate_Group
        Send DoFillList of oSellist
        Set psValgtReg to ""
        Set visible_state to True
    End_Procedure





End_Object

