LOCAL lcBuffer, ;
lcOldError, ;
lnTop, ;
lnLeft, ;
llError, ;
lnCommaPos, ;
lnDockPosition
lcBuffer = SPACE(10) + CHR(0)
lcOldError = ON('ERROR')
lnDockPosition = 0
*-- Write toolbar position to INI file
IF GetPrivStr("WindowPositions", this.Caption, "", ;
@lcBuffer, LEN(lcBuffer), ;
CURDIR() + INIFILE) > 0
*-- If an error occurs while parsing the string,
*-- just ignore the string and use the form's
*-- defaults
ON ERROR llError = .T.
lnCommaPos = AT(",", lcBuffer)
IF lnCommaPos > 0
lnTop = VAL(LEFT(lcBuffer, lnCommaPos - 1))
lnLeft = VAL(SUBSTR(lcBuffer, lnCommaPos + 1))
ELSE
lnDockPosition = VAL(lcBuffer)
ENDIF
ON ERROR &lcOldError
IF !llError
*-- If position contains a comma, then set the
*-- appropriate properties, otherwise call
*-- the Dock method.
IF lnCommaPos > 0
this.Top = lnTop
this.Left = lnLeft
ELSE
this.Dock(lnDockPosition)
ENDIF
ENDIF
ELSE
RETURN .F.
ENDIF