[Lazarus] Carbon: Simple component in a simple package with strange behavior

Tom Gregorovic _tom_ at centrum.cz
Fri May 30 13:14:33 CEST 2008


On Fri, May 30, 2008 at 12:20 PM, Bent Normann Olsen <bent at earmaster.com> wrote:
> 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?
>

Hi,
each TWinControl descendant needs to have implemented creation of
underlying Carbon control. If you want to use generic TWinControl, you
have to choose TCustomControl.

Tom



More information about the Lazarus mailing list