0

I am new to firemonkey but am using dxscene since a year now. In dxscene brush resources could be added without a hastle in the resources object (style book in firemonkey). But firemonkey boggles me, the docwiki of embaracadero suggests to manually add it in the style book which i don't know how.

Can someone help me to add brush resources in the style book so they could be looked up? Preferably a way involving the GUI.

TLama
  • 75,147
  • 17
  • 214
  • 392
Umair Ahmed
  • 2,420
  • 1
  • 21
  • 40

1 Answers1

2

Style books can only contain descendants of TFMXObject, but TBrush descends directly from TPersistent so can't be added. The FMX.types unit contains a TBrushObject which is suitable but it doesn't appear to be registered anywhere so it's not available in the tool palette.

I suggest creating a package which registers it and therefore make sit selectable. You will need to add a unit to the package such as:

unit RegisterBrushObject;
interface
uses FMX.Types;

procedure Register;

implementation
uses Classes;

procedure Register;
begin
  RegisterComponents('Custom', [TBrushObject]);
end;

initialization
  RegisterFMXClasses([TBrushObject]);
end;

Once you've added that to a package, right click on the package in the project manager (top-right) and select Install.

Mike Sutton
  • 4,191
  • 4
  • 29
  • 42
  • Thank you very very much for your help. I knew there was a TBrushObject in FMX, found it in the source but as I have never made packages/components before so didn't know about the registration thing. – Umair Ahmed Mar 06 '13 at 17:25
  • Also an error correction to your solution for newbies is to add "Classes" unit in the uses block to avoid an undeclared identifier compiler error. – Umair Ahmed Mar 06 '13 at 17:29