Hi all,
Lately I've been trying to create a package with custom components, which works already on Lazarus Win32, but gets all kinds of errors on Mac OS X, so I created a package from scratch and try to isolate different problems.
I created a new package and saved it as "TestPackage.lpk", added a new component with TWinControl as ancestor type and named it TCommonTest, named the unit NewCtrls and saved the unit as newctrls.pas. I added a new requirement to the package, so that LCL also is required by the new package.
I then manually added a new component to the unit named TComponentTest with TCommonTest as ancestor, and changed the register procedure to only register the last component.
It compiles, and the component is installed, and the component is visible in the tab "New Ctrls" on Lazarus, which is compiled to Carbon.
But when I try to drop the new component on a form (on a new and clean application) it fails saying "Error moving component ComponentTest1:TComponentTest". The new component does not appear on the Object Inspector at first, but clicking on the component tree will make it appear, and I also can select the component on the form - but nothing is added to the unit source, and the application can't run because of Class "TComponentTest" not found, which naturally is caused by nothing was added to the units uses clause.
Manually making the changes to the forms unit will cause the application to raise an exception with the message: "(V)TCarbonWSWinControl.CreateHandle Error:Not implemented - unable to create Carbon win control for ComponentTest1:TComponentTest!"
Does a new component with an ancestor type of TWinControl need special handling, or is it impossible? Or am I doing something totally wrong?
Thanks and best regards,
Normann
-------
//The NewCtrls unit is simple and looks like this:
unit NewCtrls;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs;
type
TCommonTest = class(TWinControl)
private
protected
public
published
end;
TComponentTest = class(TCommonTest)
private
protected
public
published
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('New Ctrls',[TComponentTest]);
end;
end.
-------
//And the package unit looks like this:
unit TestPackage;
interface
uses
NewCtrls, LazarusPackageIntf;
implementation
procedure Register;
begin
RegisterUnit('NewCtrls', @NewCtrls.Register);
end;
initialization
RegisterPackage('TestPackage', @Register);
end.