 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Vladimir Guest
|
Posted: Sat Nov 29, 2003 5:40 am Post subject: DBNavigator - how to overide standard "Delete Record?" messa |
|
|
Hi,
I use personaly made message dialogs in my applications
(Ok, OkCancel, YesNo, YesNoCancel, ...) and I tend all
parts of my applications to look uniformed that way.
Is there any way to overide "Delete record?" message
dialog from DBNavigator?
There is a bool property that enables/disables appearance
of that dialog, but I do not see the way how to use
Before & After Delete events.
Vladimir
|
|
| Back to top |
|
 |
Antonio Felix Guest
|
Posted: Sat Nov 29, 2003 3:41 pm Post subject: Re: DBNavigator - how to overide standard "Delete Record?" m |
|
|
Hi Vladimir
Use the BeforeDelete Event to show your custom message.
If you call Abort() then the deletion will be aborted, otherwise it will
complete
Sample:
void __fastcall TDmTab::DbParmBeforeDelete(TDataSet *DataSet)
{
AnsiString wMsg = "Do you want to Delete ";
TTable *Db = dynamic_cast<TTable *>(DataSet);
switch( Db->Tag ) {
case 2:
wMsg = wMsg + "do Grupo de Facturação:nn" + DbGrpsGrupo->AsString
+ " - " + DbGrpsDesignacao->AsString;
break;
case 3:
wMsg = wMsg + "do Item de Facturação:nn" + DbItnsGrupo->AsString
+ " - " + DbItnsItem->AsString + " - "
+ DbItnsDesignacao->AsString;
break;
case 4:
wMsg = wMsg + "do Cliente:nn" + DbClntNrCliente->AsString
+ " - " + DbClntNome->AsString;
break;
case 5:
wMsg = wMsg + "do Navio:nn" + DbShpsNrNavio->AsString
+ " - " + DbShpsNome->AsString;
break;
case 6:
wMsg = wMsg + "do Processo:nn" + DbProcNrProcesso->AsString;
break;
case 7:
wMsg = wMsg + "do Detalhe de Processo:nn" + DbDetPGrupo->AsString
+ " /" + DbDetPItem->AsString;
break;
case 11:
wMsg = wMsg + "da Linha da Factura:nn" + DbDetFNrLinha->AsString +
" /" + DbDetFValor->AsString;
break;
}
if ( Msg( wMsg, 2 ) != IDOK ) Abort();
}
Ps:
This is a shared BeforeDelete handler for some tables under a DataModule,
but you will get
the same behaviour for a single table event.
HTH
Antonio
"Vladimir" <sory (AT) muchtrouble (DOT) com> wrote
| Quote: |
Hi,
I use personaly made message dialogs in my applications
(Ok, OkCancel, YesNo, YesNoCancel, ...) and I tend all
parts of my applications to look uniformed that way.
Is there any way to overide "Delete record?" message
dialog from DBNavigator?
There is a bool property that enables/disables appearance
of that dialog, but I do not see the way how to use
Before & After Delete events.
Vladimir
|
|
|
| Back to top |
|
 |
Vladimir Guest
|
Posted: Sat Nov 29, 2003 7:02 pm Post subject: Re: DBNavigator - how to overide standard "Delete Record?" m |
|
|
| Quote: | If you call Abort() then the deletion will be aborted, >otherwise it will
complete
|
Antonio, thanks a lot for the post and for the code.
Abort() was the function that I badly needed.
Vladimir.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|