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
In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
PostEdit controll in the TDBBrowse
-
- Mensajes: 281
- Registrado: Mar Ago 15, 2006 1:50 pm
- ignacio
- Site Admin
- Mensajes: 9447
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
PostEdit controll in the TDBBrowse
Gejza,
Really strange since TBrwCol:PostEdit which is the method that fires
OnPostEdit controls possible recursivity. You can see it in Brwcol.prg at
line 884 aprox.
BTW, try to use the methods TDataset:SaveState( .T. ) and
TDataset:RestoreState( .T. )
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Gejza Horvath" <_hsoftkn@nextra.sk> escribió en el mensaje
news:[email=46710e33@ozsrv2.ozlan.local...]46710e33@ozsrv2.ozlan.local...[/email]
> 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
>
Really strange since TBrwCol:PostEdit which is the method that fires
OnPostEdit controls possible recursivity. You can see it in Brwcol.prg at
line 884 aprox.
BTW, try to use the methods TDataset:SaveState( .T. ) and
TDataset:RestoreState( .T. )
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Gejza Horvath" <_hsoftkn@nextra.sk> escribió en el mensaje
news:[email=46710e33@ozsrv2.ozlan.local...]46710e33@ozsrv2.ozlan.local...[/email]
> 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
>
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
-
- Mensajes: 281
- Registrado: Mar Ago 15, 2006 1:50 pm
PostEdit controll in the TDBBrowse
Thanks Ignacio,
great support,
those two methods does the job.
Gejza
great support,
those two methods does the job.
Gejza