Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Drag Drop delete database record

0 views
Skip to first unread message

DHastas

unread,
Mar 4, 2000, 3:00:00 AM3/4/00
to
Has anyone ever tried using a dbGrid to Drag a database record
from the the grid over a lets say a image "trash can" so that it will
delete the current record dragged. I would like to capture the selected
row and drag it to a icon then delete. I am having no luck but am
sure someone must have done something like this. Looking for small
source sample . the examples that I have seen so far did not really help

me
Thanks to anyone who knows. Got you thinking a nice little challenge
for someone?

Robert Cerny

unread,
Mar 5, 2000, 3:00:00 AM3/5/00
to
Trashcan is normally intended to let the user change his mind and eventually
revert the action.
With database it would be possible using transactions, but if you use
transactions to handle user action, concurency suffers.
Anyway, here it goes, write mousedown event for grid and dragover and
dragdrop event for trashcan icon:

procedure XX.TheDBGridMouseDown(...)
begin
if button=mbLeft then TDBGrid(Sender).BeginDrag(false,20);
end;

procedure XX.TrashCanDragover(...)
begin
accept := true;
end;

procedure XX.TrashCanDragDrop(...);
begin
if Source.InheritsFrom(TDBGrid) then
TDBGrid(Source).Datasource.Dataset.Delete;
end;

Also, add some error checking.
--
----------------------
Regards
Robert Cerny
Remove both qwe when replying
email: robert.q...@neosys.xrs.qwe.si

No questions via email, unless explicitly invited.
DHastas wrote in message <38C1D656...@investrak.com>...

0 new messages