Solved

Abort in OnBeforeDelete?

Posted on 2004-09-07
10
448 Views
Last Modified: 2010-04-05
Hi,

I have a TClientDataSet and want to display my own confirmation dialog when a user wants to delete a record. So I decided to use TDataSet.OnBeforeDelete to accomplish this.
My problem is now, if the user selects "no", how do I prevent the DataSet from deleting the record?
I haven't found a method for this purpose yet, although I'm quite sure there has to be one.
I guess it's very easy....

thx for your help,
Wyverex
0
Comment
Question by:Wyverex
  • 6
  • 3
10 Comments
 
LVL 6

Expert Comment

by:bpana
ID: 11995812
Abort;
0
 

Author Comment

by:Wyverex
ID: 11995836
TDataSet doesn't know a method called Abort though...
0
 
LVL 6

Accepted Solution

by:
bpana earned 100 total points
ID: 11995843
i know it doesn't ...

just use as:

if .... then
  Abort;
0
 
LVL 6

Expert Comment

by:bpana
ID: 11995853
Abort raises a silent exception, so it will exit the current procedure without making the post.
0
 

Author Comment

by:Wyverex
ID: 11995886
Ah. Didn't know that there was something like this in Delphi.
Thx alot!
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 6

Expert Comment

by:bpana
ID: 11995887
btw, this is in the Delphi help.
check the Delphi Help for BeforeDelete event.
0
 
LVL 6

Expert Comment

by:bpana
ID: 11995894
you welcome :)
0
 

Author Comment

by:Wyverex
ID: 11995909
>> btw, this is in the Delphi help.
>> check the Delphi Help for BeforeDelete event.

Yes, I've seen that before. But I always thought Abort is a member of TDataSet. And because I couldn't find it in TDataSet I later forgot to look elsewhere ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 11996835
:-)) funny,
the solution is in the title
0
 
LVL 6

Expert Comment

by:bpana
ID: 11996848
yes :-)
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

16 Experts available now in Live!

Get 1:1 Help Now