QueryUnload Method
Class: tsbaseform
Expand/Collapse source code of procedure QueryUnload Source Code
*-- If we don't have a toolbar, the we'll assume we're not doing any
*-- editing, so just return .T.
IF EMPTY(thisform.cToolBar)
  RETURN .T.
ENDIF

*-- Write out the contents current control
IF !thisform.WriteBuffer()
  NODEFAULT
  RETURN .F.
ENDIF

*-- If adding a new record but nothing entered yet
IF EMPTY(ALIAS())
	*- just in case
	SET DATASESSION TO (THIS.DataSessionID)
	IF EMPTY(ALIAS()) AND !EMPTY(THIS.DataEnvironment.InitialSelectedAlias) AND USED(THIS.DataEnvironment.InitialSelectedAlias)
		SELECT (THIS.DataEnvironment.InitialSelectedAlias)
	ENDIF
ENDIF
IF !EMPTY(ALIAS())
	IF thisform.IsNewAndEmpty()
	  thisform.Restore()
	ELSE
	  IF thisform.DataChanged() AND thisform.AskToSave() = IDCANCEL
	    NODEFAULT
	    RETURN .F.
	  ENDIF
	ENDIF
ENDIF

RETURN .T.