BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DBNavigator - how to overide standard "Delete Record?" messa

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Vladimir
Guest





PostPosted: Sat Nov 29, 2003 5:40 am    Post subject: DBNavigator - how to overide standard "Delete Record?" messa Reply with 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
Antonio Felix
Guest





PostPosted: Sat Nov 29, 2003 3:41 pm    Post subject: Re: DBNavigator - how to overide standard "Delete Record?" m Reply with quote



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





PostPosted: Sat Nov 29, 2003 7:02 pm    Post subject: Re: DBNavigator - how to overide standard "Delete Record?" m Reply with quote




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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.