Ok, had a quick look.

The first problem I see is that you seem to have copied over your lpr file. :? It looks just like the Background.pas unit.

Background.pas doesn't show me anything useful. Heres why:

1) I cannot see how you are creating or freeing your objects.

Your constructor and destructor are fine. You could alternately do the following...
[pascal]type
TMyClass = class(TObject)
end;[/pascal]
...and your Create and Free constructors would already exist due to the fact that it's a descendant of the base class 'TObject', which is handy as it has that basic functionality already.

The truth is it doesn't really matter what you do inside of those two though. You can have a 'Hello world!' program in there, once it's done executing it'll create or destroy the object.

Creating your own constructor or destructor is only useful if you have something extra to do such as assigning some basic values to variables or freeing allocated memory from within your object. Those are common uses, but there may be more obviously.

The best that I can do at this point is show you in short how to properly create and free an object you have already declared.

[pascal]
// Declare
type
TSimpleObject = class(TObject)
end;
var
MyObject: TSimpleObject;

begin
// Create
MyObject := TSimpleObject.Create;

// Destroy
MyObject.Free;
[/pascal]

That all there is to it really.

Why can't you just call 'MyObject.Create'? Well because MyObject is just a pointer not the actual object so you have to tell it what it belongs to before it can do anything. Since TSimpleObject is where all the function code is, only after you have pointed MyObject to it will it be able to properly execute the code.

On that same principle 'MyObject.Free' will work just fine because it already is pointing to where it needs and is fully allocated.


Hope this helps. If not then let us know and we'll do our best to clear up any fuzzy spots.