Solved

How to cancel an action

Posted on 2001-06-14
5
925 Views
Last Modified: 2010-04-06
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
Comment
Question by:ajgonzalezm
5 Comments
 
LVL 12

Expert Comment

by:rwilson032697
Comment Utility
The quickest and easiest way is to call the 'Abort' procedure.

Cheers,

Raymond.
0
 
LVL 44

Accepted Solution

by:
CrazyOne earned 50 total points
Comment Utility
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
 
LVL 1

Expert Comment

by:Greyman
Comment Utility
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
 

Author Comment

by:ajgonzalezm
Comment Utility
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
 
LVL 44

Expert Comment

by:CrazyOne
Comment Utility
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

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now