Board index » cppbuilder » How to avoid TDBNavigator to remove an item (inside the BeforeAction-event)

How to avoid TDBNavigator to remove an item (inside the BeforeAction-event)

Having a DBNavigator, which '-' (DELETE) button should do some testing in
which the decision takes place, if the record is deleted or not. So I  use
the OnBeforeAction()-event of TDBNavigator:

So my event looks like the following:

void __fastcall TFormDBNames::DBNavigatorNamesBeforeAction(TObject *Sender,
      TNavigateBtn Button)
{
  if(Button==nbDelete) {
    if(Test()!=success) {
       // avoid the record-remove takes place. How?
    }
  }

Quote
}

So how can I avoid the action (=deletion) of the record takes place?
Should I throw an exception? (But where to catch it?)

Thanks,

MR

 

Re:How to avoid TDBNavigator to remove an item (inside the BeforeAction-event)


Call Abort();.  This will stop the DBNavigator from doing its default actaion
for hte button.  Questions of this nature tend to belong in the Database groups
since those are dedicated to the database part of BCB.  (This question is
frequently answered there so you would have already seen the answer if you
looked :) ).

Quote
MR wrote:

> Having a DBNavigator, which '-' (DELETE) button should do some testing in
> which the decision takes place, if the record is deleted or not. So I  use
> the OnBeforeAction()-event of TDBNavigator:

> So my event looks like the following:

> void __fastcall TFormDBNames::DBNavigatorNamesBeforeAction(TObject *Sender,
>       TNavigateBtn Button)
> {
>   if(Button==nbDelete) {
>     if(Test()!=success) {
>        // avoid the record-remove takes place. How?
>     }
>   }
> }

> So how can I avoid the action (=deletion) of the record takes place?
> Should I throw an exception? (But where to catch it?)

> Thanks,

> MR

--
Jeff Overcash (TeamB)   On waves of silver I dreamed of gold
(Please do not email    'Till I lost the peace that dreaming gives
 me directly unless     I dreamed of the moment of my own death
 asked.  Thank You)     That no one ever dreams and lives (Marillion)

Re:How to avoid TDBNavigator to remove an item (inside the BeforeAction-event)


Quote
: "MR" <m...@nikocity.de> wrote:
>So how can I avoid the action (=deletion) of the record takes place?

MR, this here isn't really where the people who know about your database
or database component problem hang out. If you don't get an answer to your
question in this group within the next couple of days, or if you want to
respond to an answer, a much better place probably is the group

  news:borland.public.cppbuilder.database.desktop

To learn more about this server and the groups that it carries, have a
look at http://www.borland.com/newsgroups/

Generally, it is always best to post to the single most appropriate group.

Thanks!

--
General information:
  * Post to the right group - http://www.borland.com/newsgroups/
    * Do not cross- or multipost
      * Research at http://www.mers.com/searchsite.html

Stefan Hoffmeister - http://www.econos.de/
TeamB - http://www.teamb.com/

Re:How to avoid TDBNavigator to remove an item (inside the BeforeAction-event)


Quote
> Call Abort();.  This will stop the DBNavigator from doing its default
actaion
> for hte button.
>Questions of this nature tend to belong in the Database groups
> since those are dedicated to the database part of BCB.  (This question is
> frequently answered there so you would have already seen the answer if you
> looked :) ).

Hmm? Perhaps it is, but it does not concern the database itself, but the
handling of the component TDBNavigator, which is accidently a component
concerning the database. The question could also be, how can I stop a
non-database-component from doing <X> when their event Before<X> is called.

I suppose I can this do using Abort() function too.

Thanks,

MR

Other Threads