Board index » delphi » TDBNavigator stopping delete events

TDBNavigator stopping delete events

how can I stop the deletion of a record occuring from within the
DBNavigator.BeforeACtion event, as shown below?

procedure TForm1.DBNavigator1BeforeAction(Sender: TObject;
  Button: TNavigateBtn);
begin
   case Button of
    nbDelete:
       begin
        if((MessageDlg('Delete record?',
            mtConfirmation, [mbOK, mbCancel], 0) = id_Cancel)
           and ( USERNAME <> CURRUSER))
        then            <----------------- I need to know how to STOP
       end;                              the record being deleted here

    end;

end;

 

Re:TDBNavigator stopping delete events


Hello,

The 'abort' procedure is the answer to your question. See below...
Regards,
Emmanuel.

Finn Austin <re...@dial.pipex.com> wrote in article
<34c5ccfd.10524...@news.dial.pipex.com>...

Quote
> how can I stop the deletion of a record occuring from within the
> DBNavigator.BeforeACtion event, as shown below?

> procedure TForm1.DBNavigator1BeforeAction(Sender: TObject;
>   Button: TNavigateBtn);
> begin
>    case Button of
>     nbDelete:
>        begin
>         if((MessageDlg('Delete record?',
>             mtConfirmation, [mbOK, mbCancel], 0) = id_Cancel)
>            and ( USERNAME <> CURRUSER))
>         then            <----------------- I need to know how to STOP

              abort; {...is the way to stop it!}

- Show quoted text -

Quote
>        end;                                 the record being deleted here

>     end;

> end;

Other Threads