Solved

Abort in OnBeforeDelete?

Posted on 2004-09-07
10
458 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
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.

 
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
 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

856 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