|
You can't delete this item at this stage as its
used for other methods internally fired with the drag drop event.
Instead try something like this:
1. replace oldcb.free with postmessage
e.g.
postmessage(self.handle,wm_user+1,0,0);
2. Declare in the CheckGroup Object a new method
receiving your message. e.g.
procedure DeleteSomething(var Message: TMessage);
message WM_user+1;
3. Setup the Method and move the lines beneath the
oldcb.free into it. e.g.
procedure TCheckGroup.DeleteSomething(var Message:
TMessage); begin if assigned(freeob) then
begin
freeandnil(freeob);
ArrangeCheckBoxList; FUpdating :=
False; end;
end;
Code not great but gives you the idea.
Matt.
----- Original Message -----
Sent: Thursday, September 30, 2004 9:58
PM
Subject: [DUG] TCheckGroup
Hi David and everyone.
I got around the BeginDrag method causing a
premature tick in a CheckBox. I have a more serious problem now which
I've been trying to solve for several hours but I'm not getting
anywhere.
I'm getting either an access violation or an
"Abstract Error" when dragging checkboxes in the CheckGroup. In my
larger program, it actually works fine for 1 or 2 drags, but the
next one produces the error. In the test program, it occurs every
time.
The error is occuring in the System.GetDynaMethod
assember code which doesn't help me much. Here is a download of
the component and a small test program. I hope someone can
help.
Compile, run, and drag one item onto
another to produce the error.
In the cbDragDrop procedure, a copy of the
dragged checkbox details (CBOld) is inserted at the drop location, and
then the dragged checkbox is freed. The
error does not occur if I remark out the line: OldCB.Free. Perhaps
the freed checkbox is being accessed somewhere but I can't establish
where. I've tried break points in every
procedure/function.
It's a little messy with the
TList and TStringList being used together but I'll clean that up
later.
Many
thanks,
Ross.
_______________________________________________ Delphi mailing
list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
|