PostEdit controll in the TDBBrowse
Publicado: Jue Jun 14, 2007 11:44 am
Hi,
the TDBBrowse object is in the Edit() mode. Finishing the edit, I would like to know, if
the changed key already exists in the table. If yes, the message will shown "Key already
exists" and the changes are cancelled. I try the next code in OnPostEdit event:
METHOD DBBrowse1PostEdit( oSender, lCanceled, nKey ) CLASS TFormCiselnik
LOCAL lReturn
lReturn := .T.
IF ::oDbfDataSet1:Typ(dsFIELD) <> ::oDbfDataSet1:Typ(dsVAR)
IF ::oDbfDataSet1:Seek(::oDbfDataSet1:Typ(dsFIELD),.F.)
MsgBox("The key is already in the table","PostEdit")
lReturn := .F.
ENDIF
ENDIF
lCanceled := lReturn
RETURN NIL
This method is called in endless loop after ::oDbfDataSet1:Seek() method, and I see this
message in every loop, until the app is terminated from IDE.
Any idea how to realize this behaviour??
Gejza Horvath
the TDBBrowse object is in the Edit() mode. Finishing the edit, I would like to know, if
the changed key already exists in the table. If yes, the message will shown "Key already
exists" and the changes are cancelled. I try the next code in OnPostEdit event:
METHOD DBBrowse1PostEdit( oSender, lCanceled, nKey ) CLASS TFormCiselnik
LOCAL lReturn
lReturn := .T.
IF ::oDbfDataSet1:Typ(dsFIELD) <> ::oDbfDataSet1:Typ(dsVAR)
IF ::oDbfDataSet1:Seek(::oDbfDataSet1:Typ(dsFIELD),.F.)
MsgBox("The key is already in the table","PostEdit")
lReturn := .F.
ENDIF
ENDIF
lCanceled := lReturn
RETURN NIL
This method is called in endless loop after ::oDbfDataSet1:Seek() method, and I see this
message in every loop, until the app is terminated from IDE.
Any idea how to realize this behaviour??
Gejza Horvath