*这个是cmdEdit的
#DEFINE C_NOUPDATE_LOC
"由于选定的视图不发送更新因此你不能编辑它。"
LOCAL lNoSendParentUpdates,lNoSendChildUpdates
LOCAL aTablesUsed,nTablesUsed,i
IF EMPTY(ALIAS())
RETURN
ENDIF
** Reverting record
IF THIS.Parent.EditMode
IF THIS.Parent.UseDataEnv
SELECT (THIS.Parent.OldAlias)
IF CURSORGETPROP("Buffering")>1
=TableRevert(.T.)
ENDIF
IF !EMPTY(THIS.Parent.GridAlias)
SELECT (THIS.Parent.GridAlias)
IF CURSORGETPROP("Buffering")>1
=TableRevert(.T.)
ENDIF
ENDIF
ELSE
DIMENSION aTablesUsed[1]
m.nTablesUsed = AUSED(aTablesUsed)
FOR i = 1 TO m.nTablesUsed
IF CURSORGETPROP("Buffering",aTablesUsed[m.i,1])>1
=TableRevert(.T.,aTablesUsed[m.i,1])
ENDIF
ENDFOR
ENDIF
* Go back to original place
SELECT (THIS.Parent.OldAlias)
IF RECCOUNT() < THIS.Parent.OldRec
&&added record at EOF()
GO TOP
ELSE
GO THIS.Parent.OldRec
ENDIF
ELSE
* Check to see if view allows updates
IF CURSORGETPROP("SourceType")#3 AND !CURSORGETPROP("offline") AND;
!CURSORGETPROP("SendUpdates") AND CURSORGETPROP("SourceType")<100
lNoSendParentUpdates = .T.
ENDIF
IF !EMPTY(THIS.Parent.GridAlias) AND ;
CURSORGETPROP("SourceType",THIS.Parent.GridAlias)#3 AND ;
!CURSORGETPROP("offline",THIS.Parent.GridAlias) AND ;
!CURSORGETPROP("SendUpdates",THIS.Parent.GridAlias)
lNoSendChildUpdates= .T.
ENDIF
IF (m.lNoSendChildUpdates AND m.lNoSendParentUpdates) OR;
(EMPTY(THIS.Parent.GridAlias) AND m.lNoSendParentUpdates)
MESSAGEBOX(C_NOUPDATE_LOC)
RETURN
ENDIF
THIS.Parent.OldAlias = ALIAS()
&&save alias in case reverting
THIS.Parent.OldRec = RECNO()
&&save record in case reverting
ENDIF
** Editing record
THIS.Parent.EditMode = !THIS.Parent.EditMode
THIS.Parent.AddMode = .F.
THIS.Parent.ButtonRefresh()
THIS.Parent.NavRefresh()