Hi,
I have a DBBrowse and DBNavigator linked to DbfDataset. All operations like Append,
Delete,Edit and navigation are OK. I have a problem, when the browser is in append or edit
mode. Pressing the Cancel button on the DBNavigator in this moment, I get this message
from dataset:
Invalid use of 'Cancel', set must be on 'Edit' or 'AddNew' mode[#0]
On procedure: TDDBROWSE:CANCELEDIT line 1041.
and the changes (or new record) are saved. When I teminate the edit process pressing the
ESC key, it works like excepted: changes are lost, record is not saved.
In the DBNavigator are defined:
:OnClickEdit := {|| ::oDBBrowse1:Edit()}
:OnClickInsert := {|| ::oDBBrowse1:Append()}
What is the reason of this behaviour and how to avoid it?
Gejza
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.
Dataset - Cancel not allowed
-
- Mensajes: 281
- Registrado: Mar Ago 15, 2006 1:50 pm
-
- Mensajes: 281
- Registrado: Mar Ago 15, 2006 1:50 pm
Dataset - Cancel not allowed
I get the same message pressing the Update button.
Gejza
Gejza
- ignacio
- Site Admin
- Mensajes: 9447
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Dataset - Cancel not allowed
Gezja,
The TDBBrowse object is not mean to be used with TDBNavigator directly.
BTW, here is the code to make it work:
//---------------------------------------------------------- --------------------
METHOD DBNavigatorClickDelete( oSender ) CLASS TFrm
WITH OBJECT ::oDataSet
:Delete()
END WITH
RETURN .F.
//---------------------------------------------------------- --------------------
METHOD DBNavigatorClickInsert( oSender ) CLASS TFrm
::oDbBrowse:Append()
oSender:UnLock()
RETURN .F.
//---------------------------------------------------------- --------------------
METHOD DBNavigatorClickEdit( oSender ) CLASS TFrm
::oDbBrowse:Edit()
oSender:UnLock()
RETURN .F.
//---------------------------------------------------------- --------------------
METHOD DBNavigatorClickUpdate( oSender ) CLASS TFrm
::oDbBrowse:CancelEdit()
RETURN .F.
//---------------------------------------------------------- --------------------
METHOD DbBrowsePostEdit( oSender, lCanceled, nKey ) CLASS TFrm
::oDbNavigator:Lock()
RETURN Nil
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Gejza Horvath" <_hsoftkn@nextra.sk> escribió en el mensaje
news:[email=467cae75@ozsrv2.ozlan.local...]467cae75@ozsrv2.ozlan.local...[/email]
> Hi,
>
> I have a DBBrowse and DBNavigator linked to DbfDataset. All operations
> like Append, Delete,Edit and navigation are OK. I have a problem, when the
> browser is in append or edit mode. Pressing the Cancel button on the
> DBNavigator in this moment, I get this message from dataset:
>
> Invalid use of 'Cancel', set must be on 'Edit' or 'AddNew' mode[#0]
> On procedure: TDDBROWSE:CANCELEDIT line 1041.
>
> and the changes (or new record) are saved. When I teminate the edit
> process pressing the ESC key, it works like excepted: changes are lost,
> record is not saved.
>
> In the DBNavigator are defined:
>
> :OnClickEdit := {|| ::oDBBrowse1:Edit()}
> :OnClickInsert := {|| ::oDBBrowse1:Append()}
>
> What is the reason of this behaviour and how to avoid it?
>
> Gejza
>
The TDBBrowse object is not mean to be used with TDBNavigator directly.
BTW, here is the code to make it work:
//---------------------------------------------------------- --------------------
METHOD DBNavigatorClickDelete( oSender ) CLASS TFrm
WITH OBJECT ::oDataSet
:Delete()
END WITH
RETURN .F.
//---------------------------------------------------------- --------------------
METHOD DBNavigatorClickInsert( oSender ) CLASS TFrm
::oDbBrowse:Append()
oSender:UnLock()
RETURN .F.
//---------------------------------------------------------- --------------------
METHOD DBNavigatorClickEdit( oSender ) CLASS TFrm
::oDbBrowse:Edit()
oSender:UnLock()
RETURN .F.
//---------------------------------------------------------- --------------------
METHOD DBNavigatorClickUpdate( oSender ) CLASS TFrm
::oDbBrowse:CancelEdit()
RETURN .F.
//---------------------------------------------------------- --------------------
METHOD DbBrowsePostEdit( oSender, lCanceled, nKey ) CLASS TFrm
::oDbNavigator:Lock()
RETURN Nil
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Gejza Horvath" <_hsoftkn@nextra.sk> escribió en el mensaje
news:[email=467cae75@ozsrv2.ozlan.local...]467cae75@ozsrv2.ozlan.local...[/email]
> Hi,
>
> I have a DBBrowse and DBNavigator linked to DbfDataset. All operations
> like Append, Delete,Edit and navigation are OK. I have a problem, when the
> browser is in append or edit mode. Pressing the Cancel button on the
> DBNavigator in this moment, I get this message from dataset:
>
> Invalid use of 'Cancel', set must be on 'Edit' or 'AddNew' mode[#0]
> On procedure: TDDBROWSE:CANCELEDIT line 1041.
>
> and the changes (or new record) are saved. When I teminate the edit
> process pressing the ESC key, it works like excepted: changes are lost,
> record is not saved.
>
> In the DBNavigator are defined:
>
> :OnClickEdit := {|| ::oDBBrowse1:Edit()}
> :OnClickInsert := {|| ::oDBBrowse1:Append()}
>
> What is the reason of this behaviour and how to avoid it?
>
> Gejza
>
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