Solved

How to cancel an action

Posted on 2001-06-14
5
936 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
ID: 6193867
The quickest and easiest way is to call the 'Abort' procedure.

Cheers,

Raymond.
0
 
LVL 44

Accepted Solution

by:
CrazyOne earned 50 total points
ID: 6193869
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
ID: 6194027
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
ID: 6195409
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
ID: 6195459
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

911 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

21 Experts available now in Live!

Get 1:1 Help Now