Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1101
  • Last Modified:

How to cancel an action

In the standard dbnavigator bar (Delphi 5) there is an event called 'BeforeAction'. How can I cancel or abort the action (any of them) from within this event?

Thanks !

AJ
0
ajgonzalezm
Asked:
ajgonzalezm
1 Solution
 
rwilson032697Commented:
The quickest and easiest way is to call the 'Abort' procedure.

Cheers,

Raymond.
0
 
CrazyOneCommented:
SysUtils.Abort;

Delphi Help
Ends the current process without reporting an error.

Unit

Sysutils

Category

flow control routines

procedure Abort;

Description

Use Abort to escape from an execution path without reporting an error.

Abort raises a special "silent exception" (EAbort), which operates like any other exception, but does not display an error message to the end user.  Abort redirects execution to the end of the last try .. finally block.
0
 
GreymanCommented:
Or, if you are logging your exceptions, you can be really fancy and do this:

raise EAbort.Create('Operation cancelled by user');

The user won't see that text, but the exception handling system will :)
0
 
ajgonzalezmAuthor Commented:
CrazyOne: We were using abort alone and it didn't work that way. Using SysUtils.Abort solved the problem.

Thanks a lot. (to all of you)

Regards,


AJ
0
 
CrazyOneCommented:
Yeah I was getting compiling errors just using Abort and to this day I don't know why so I have gotten use to doing SysUtils.Abort instead. Glad we were able to help you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now