delphidelphi-xe2ttnavigatoranydac

How can I abort deletion of record based on decisions after dbnavigator delete button pressed?


Can I abort deletion of record based on decisions after dbnavigator delete button pressed? I checked beforeAction Event

if Button = nbDelete then  
  //check if not OK then

Button := nbCancel;

but it doesn't work. Any Help?

I'm using DelPhi XE2, anyDac Components


Solution

  • Use the BeforeAction event

    procedure TForm1.DBNavigator1BeforeAction(Sender: TObject; Button: TNavigateBtn);
    begin
      if Button = nbDelete then
      begin
        if MessageDlg('Confirm delete now?', mtConfirmation, [mbYes,mbNo], 0) = mrNo then
        begin
          Abort;
        end;
      end;
    end;