Use dbUpdateUtilAllEnt.pkg
Use cWsProgressBar.pkg

Object Update_vw is a ToolPanel

  Property String pTestfile public ""

  //Holds the fieldnumber for  the choosen field that the missing fieldname is identical with
  Property Integer piChoosenField public 0

  //For errortreatment
  Property Integer error_processing_state public 0
  Property Integer OldErrId public 0
  Property Integer piActFilenumber public 0
  Property String psActFilename public 0
  Property Integer pAbort public 1    // Different for Manupd.src

  Set Label to "Databaseupdate v6.01"
  Set Size to 36 339
  Set Location to 8 13
  Set Sysmenu_Icon to False
  Set view_mode to viewmode_normal
  Set locate_mode to CENTER_ON_SCREEN
  Set Border_Style to Border_Dialog

  Object cnt3DBox is a Container3d

    Set Size to 34 337
    Set Location to 1 1

    Object frmDatabase is a Form
      Set Size to 1 1
      Set Location to -10 -10
      Set enabled_state to False
      Set visible_state to False
    End_Object

    Object DirInput is a Form
      Set Size to 0 0
      Set Location to -10 -10
    End_Object

    Object pStatus is a cWsProgressbar
      Set Size to 13 273
      Set Location to 2 59
      Set piMaximum to 250
      Set piAdvanceBy to 1
        Set pbSmooth to True
    End_Object    // pStatus

    Object Textbox1 is a Textbox
      Set Label to "Updated:"
      Set TypeFace to "MS Sans Serif"
      Set FontSize to 4 0
      Set Size to 10 35
      Set Location to 4 23
    End_Object    // Textbox1

    Object Textbox2 is a Textbox
      Set Label to "DBfilestatus:"
      Set TypeFace to "MS Sans Serif"
      Set FontSize to 4 0
      Set Size to 10 48
      Set Location to  17 13
    End_Object    // Textbox2

    Object pWorking is a cWsProgressbar
      Set Size to 6 273
      Set Location to 17 59
      Set piAdvanceBy to 1
        Set pbSmooth to True
    End_Object    // pWorking

    Object pCallback is a cWsProgressbar

      Function CallBack String callback_msg Integer callback_type Returns Integer
        Integer val1 val2 iCommaPos iCurrentpos
        Number nOffset
        Trim callback_msg to callback_msg
        If (Callback_type = DF_MESSAGE_PROGRESS_VALUE) Begin
          Pos "," in callback_msg to iCommaPos
          Left callback_msg to val1 (iCommaPos -1)
          Right callback_msg to val2 (Length(callback_msg)-iCommaPos)
          calc (val2 / 100) to nOffset
          Calc (val1 / nOffset) to iCurrentpos
          Set piPosition to iCurrentpos
        End
        Else Set piPosition to 0
        Function_Return False   //Forts‘t processen
      End_Function

      Set Size to 6 273
      Set Location to 23 59
      Set piAdvanceBy to 1
        Set pbSmooth to True
    End_Object    // pCallback

  End_Object    // cnt3DBox

  #Include Update.inc

    Procedure DoUpdate
        String sTest sTestfile
        Send Activate   // Show the toolpanel
        Send Update
        Get_Profile_String "DEFAULTS" "Update testmode" to sTest
        If (sTest = "YES") Begin
          Get pTestFile to sTestfile
          Insert (Character(32)) in sTestfile At 1
          Append sTestfile (Character(32))
          Runprogram Wait "notepad.exe" sTestfile
        End
    End_Procedure

End_Object    // Update_vw

Send DoUpdate to (Update_vw(Self))
