Solved

How to cancel an action

Posted on 2001-06-14
5
948 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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
proper way to parse text with delphi 7 121
Path  to current project in Delphi. 2 79
Create Database on Android via Delphi dbExpress 3 90
Intraweb download file link ? 1 133
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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

773 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