Ok guys, hopefully someone can help me as this is driving me crazy here! I've spent 2 hours trying to find why my properties aren't showing up in the object inspector but I'm completely stuck.


Ok guys, hopefully someone can help me as this is driving me crazy here! I've spent 2 hours trying to find why my properties aren't showing up in the object inspector but I'm completely stuck.

I've written lots of components which is why it's got me completely baffled!

I can only think that I'm missing something really obvoius... anyway, I've stripped the component down to the bare code which inherits from a TSpeedButton and adds a "badge" sub-property.

I get the "Badge" property in the object inspector with a + symbol next to it to expand the properties, but on clicking it, it does not expand and no properties are shown!?

Here's the component code... and I'll attach an image of the object inspector. Any help is appreciated!

Delphi Seattle (Firemonkey)

------------------------------

unit ksSpeedButton;

interface

uses Classes, FMX.StdCtrls, FMX.Graphics;

{$IFDEF VER290}
{$DEFINE XE8_OR_NEWER}
{$ENDIF}
{$IFDEF VER300}
{$DEFINE XE8_OR_NEWER}
{$DEFINE XE10_OR_NEWER}
{$ENDIF}

type
TksBadgeProperties = class(TPersistent)
private
FValue: Integer;
procedure SetValue(const Value: integer);
public
constructor Create; virtual;
procedure Assign(Source: TPersistent); override;
published
property Value: integer read FValue write SetValue default 0;
end;


TksSpeedButton = class(TSpeedButton)
private
FBadge: TksBadgeProperties;
procedure SetBadge(Value: TksBadgeProperties);
function GetBadge: TksBadgeProperties;
public
constructor Create(AOwner: TComponent);
destructor Destroy; override;
published
property Badge: TksBadgeProperties read FBadge write SetBadge;
end;


procedure Register;

implementation

uses Math;

procedure Register;
begin
RegisterComponents('Kernow Software FMX', [TksSpeedButton]);
end;


{ TksSpeedButton }

constructor TksSpeedButton.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FBadge := TksBadgeProperties.Create;
end;

destructor TksSpeedButton.Destroy;
begin
{$IFDEF NEXTGEN}
FBadge.DisposeOf;
{$ELSE}
FBadge.Free;
{$ENDIF}
inherited;
end;


function TksSpeedButton.GetBadge: TksBadgeProperties;
begin
Result := FBadge;
end;

procedure TksSpeedButton.SetBadge(Value: TksBadgeProperties);
begin
FBadge.Assign(Value);
end;

{ TksBadgeProperties }

procedure TksBadgeProperties.Assign(Source: TPersistent);
begin
inherited;
FValue := (Source as TksBadgeProperties).Value;
end;

constructor TksBadgeProperties.Create;
begin
inherited Create;
FValue := 0;
end;

procedure TksBadgeProperties.SetValue(const Value: integer);
begin
FValue := Value;
end;

end.

Comments