Delphi and Kylix

Moderators: pritaeas
Number of threads: 7244
Number of posts: 19051

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Pointer Problems with TComponentList Posted by ockiejvs on 6 May 2010 at 10:19 AM
I have the following pointer problem:
The shape was created dynamically, and was accessable through a pointer pointing to the object in a componentlist.


procedure Tfrm_tyd.OnMouseDownEvent(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
ManyShape: TManyShape;
//pointer: Integer;
begin
if (Sender is TManyShape) then
begin
pointer := ComponentList1.IndexOf(ManyShape);
ManyShape:= TManyShape(ComponentList1[pointer]);
ManyShape.BeginDrag(True);
end
else
begin
BeginDrag(False);
ShowMessage('False');
end;

end;


procedure Tfrm_tyd.FormDragDrop(Sender, Source: TObject; X, Y: Integer);
var
ManyShape: TManyShape;
pointer: Integer;

begin
if Source is TManyShape then
begin

pointer := ComponentList1.IndexOf(ManyShape);
//ComponentList1.
ShowMessage(inttostr(pointer));

///////////////////////////////////////////////////////////
//Asblik
else if ((X > 416 + 120) and (X < 416 + 120+ 30)) and ((Y > 144) and (Y < 144 + 120)) then
begin
//ManyShape.Destroy;
end

The problem is that the valua of the pointer in the next procedure does not correspond to the value of the pointer in the OnMouseDown event. I suspect it has something to do with dereferencing, something I worked with many years ago briefly. Can anyone help? Am I on the right track? I basically want to destroy the object with the FormDragDrop event by dropping it in a 'recycle bin area' (top, left, width, height) on the canvas.
Report
This post has been deleted. Posted by dsd123 on 10 May 2010 at 8:46 AM
This post has been deleted.
Report
This post has been deleted. Posted by dsd123 on 10 May 2010 at 8:48 AM
This post has been deleted.
Report
This post has been deleted. Posted by acetechcn on 31 May 2010 at 11:34 PM
This post has been deleted.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.