If you need to cancel the action raised by a click on one of DBNavigator buttons, you need to Abort the action in the BeforeAction event.
In Delphi database applications, where the TDBnavigator is used to edit and navigate through the dataset, if you need to cancel the click on a particular button, use the next code (handle the BeforeAction event, by calling Abort for a particular button):
~~~~~~~~~~~~~~~~~~~~~~~~~
procedure TDBForm.DBNavigatorBeforeAction(Sender: TObject;
Button: TNavigateBtn) ;
begin
if (Button = nbRefresh) then
begin
SysUtils.Abort; //cancel the refresh action
end;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~
Note: The Abort procedure from the SysUtils unit raises a so-called "silent exception" (EAbort), which does not display an error message to the user.
Delphi tips navigator:
» Fixing the "Transaction ... an object is in a zombie state" error in Delphi ADO database applications
« Fixing the CheckBoxList ASP.NET Web Server control - adding Attributes to Items
