VO1TOVO2.TXT

(3 KB) Pobierz
       Code Modifications for VO 1.0 to VO 2.0 Migration
                 By Uzi Nitsan  CIS# 71035,3376
                           6-Jan-97

Here is a list of some of the code modifications I had to make in
ordert to migrate a large VO 1.0 application to VO 2.0.  This is by
no means a comprehensive list, and I haven't included API issues.

- Handles:
  - If you used numeric type vars to store handles, change the
    type of all these vars to PTR.  Example:
    - VO 1.0:
        local hWin  as word
        hWin := oWindow:handle()
        if hWin > 0
          // oWindow exists
    - VO 2.0:
        local hWin  as ptr
        hWin := oWindow:handle()
        if hWin != NULL_PTR
          // oWindow exists

- FixedIcon:
  - Dynamic instantiation of FixedIcon objects causes a runTime error
    (wrong type of a parameter).  Example:
      oRID := ResourceID{long(_cast, IDI_EXCLAMATION), ;
                         ResourceFile{"USER32.DLL"}}
      self:oCIcon := FixedIcon{self, ID_ICON, Point{50, 50}, oRID}
    I don't yet have a workaround.

- Function StoD
  - If you passes a string argument, change it to PSZ.  For example,
    change:
      dDate := StoD(cYear + '1231')
    to:
      dDate := StoD(psz(cYear + '1231'))

- Functions DBUseArea() and VOSBUseArea()
  - The arguments have been changed in VO 2.0.  Consult the docs. Example:
    VO 1.0:
      VODbUseArea(.T., 'DBFNTX', cFilePath, NULL_STRING, .F., .F., NULL_PTR)
    VO 2.0:
      VODBUseArea(.T., NULL_PTR, cFilePath, NULL_STRING, .F., .F. )

- FileSpec:Path
  - In VO 2.0 this access returns the trailing backslash (\); in VO 1.0
    it does not.  Example (oFS is a FileSpec object):
    VO 1.0:
      cFullPath := oFS:drive + oFS:path + '\' + oFS:fileName + '.DBF'
    VO 2.0:
      cFullPath := oFS:drive + oFS:path + oFS:fileName + '.DBF'

- _DLL FUNC FindWindow()
  - Removed (the VO 2.0 System Lib supports this function.

- Pointer:init()
  - VO 1.0 accepts NIL as a parameter, but VO 2.0 does not.  Example:
    VO 1.0:
      oWindow:pointer := Pointer{}
    VO 2.0:
      oWindow:pointer := Pointer{POINTERARROW}

- Divison operator:
  - If you have code in which an integer is divided by a float, you
    may get a compiler error.  For example, replace this:
      nQuarter := ceil(nMonth/3.)
    with:
      nQuarter := ceil(nMonth/3)

- Function CopyFile():
  - No longer supported in VO 2.0.  Replace it with function fCopy().

- DataBrowser:aColumnList:
  - If you use the protect iVar DataBrowser:aColumnList, note that in
    VO 2.0 it is replaced with DataBrowser:aColumn.

- DataBrowser:cellDoubleClick()
  - In VO 2.0, DataBrowser inherits directly from Control (instead of from
    DataBrowserAbstract in VO 1.0).  If you used method
    DataBrowser:cellDoubleClick(), replace:
      super:cellDoubleClick()
    with:
      super:mouseButtonDoubleClick()

- Custom toolBars buttons:
  - If you used a "dummy custom toolBar" for creating custom toolBars
    buttons, you can remove it now.  VO 2.0 allows you to append custom
    buttons to any toolBar.

- Balloons:
  - If you used Ben Howerton's "Balloons", you can remove them under
    VO 2.0, and use native "ToolTips".

- Misc syntax problems:
  - VO 2.0 is more stringent about syntax.  Some sloppy code that didn't
    generate compiler errors under VO 1.0 had to be fixed in order to
    pass the VO 2.0 compiler.  Examples:
    - Extraneous ";" trailer:
        export n  as word ;
        export c  as string
    - Missing comma:
        export n  as word ;
               c  as string




Zgłoś jeśli naruszono regulamin