FMX Component style not showing correctly in IDE

  

Below are the sources to a very simple FMX component that simply inherits from a TCustomEdit but with a different Style. What I am going for is to have two buttons on the Windows version of the component and no buttons on the Android component.
When I compile the sources before and run a program with the component, both devices show the components as expected. Windows shows the two buttons, Android doesn’t display the buttons.
My problem is, during design time in the IDE, setting the "Style" drop down to Android, the component is displayed using the Windows version. If I "edit the default style" when the Android style is selected, it shows the Edit "background" with a sourcelookup of "Windows 10 Desktopstyle.png", not "AndroidL Lightstyle.png" but also includes the buttons with a sourcelookup of "AndroidL Lightstyle.png".
My assumption is I am missing something is my component design that tells the IDE which version of style to use. Any idea what that is? FYI: this is a very simple component that shows the problem. My more complicated component has the same problem.
unit RHEdit;

interface

uses
System.SysUtils, System.Classes, FMX.Types, FMX.Controls, FMX.Controls.Presentation, FMX.Edit, FMX.Controls.Model;

type
TRHEdit = class(TCustomEdit)
private
{ Private declarations }
protected
function GetStyleObject(const Clone: Boolean): TFmxObject; override;
function DefinePresentationName: string; override;
public
{ Public declarations }
published
property Text;
end;

procedure Register;

implementation

{$IFDEF ANDROID}
{$R RHEdit_android.res}
{$ENDIF}
{$IFDEF MSWINDOWS}
{$R RHEdit_win.res}
{$ENDIF}

uses System.Types, FMX.Styles;

procedure Register;
begin
RegisterComponents(‘Samples’, [TRHEdit]);
end;

{ TRHEdit }

function TRHEdit.DefinePresentationName: string;
begin
Result := ‘RHEdit-‘ + GetPresentationSuffix;
end;

function TRHEdit.GetStyleObject(const Clone: Boolean): TFmxObject;
var
style: string;
begin
style := ‘rheditstyle’;
if (StyleLookup = ”) then
Result:= TStyleStreaming.LoadFromResource(HInstance, Style, RT_RCDATA)
else
Result := inherited GetStyleObject(Clone);
end;

end.

RHEdit_android.rc
RHEditStyle RCDATA "RHEdit_android.style"

RHEdit_win.rc
RHEditStyle RCDATA "RHEdit_win.style"

RHEdit_android.style
object TLayout
StyleName = ‘rheditstyle’
TabOrder = 12
FixedHeight = 32
object TActiveStyleObject
StyleName = ‘background’
Align = Contents
SourceLookup = ‘AndroidL Lightstyle.png’
ActiveTrigger = Focused
ActiveLink = <
item
CapInsets.Left = 4.000000000000000000
CapInsets.Right = 4.000000000000000000
SourceRect.Left = 94.000000000000000000
SourceRect.Top = 63.000000000000000000
SourceRect.Right = 127.000000000000000000
SourceRect.Bottom = 95.000000000000000000
end
item
CapInsets.Left = 6.000000000000000000
CapInsets.Right = 6.000000000000000000
Scale = 1.500000000000000000
SourceRect.Left = 157.000000000000000000
SourceRect.Top = 95.000000000000000000
SourceRect.Right = 206.000000000000000000
SourceRect.Bottom = 143.000000000000000000
end
item
CapInsets.Left = 8.000000000000000000
CapInsets.Right = 8.000000000000000000
Scale = 2.000000000000000000
SourceRect.Left = 187.000000000000000000
SourceRect.Top = 122.000000000000000000
SourceRect.Right = 253.000000000000000000
SourceRect.Bottom = 186.000000000000000000
end
item
CapInsets.Left = 12.000000000000000000
CapInsets.Right = 12.000000000000000000
Scale = 3.000000000000000000
SourceRect.Left = 337.000000000000000000
SourceRect.Top = 190.000000000000000000
SourceRect.Right = 436.000000000000000000
SourceRect.Bottom = 286.000000000000000000
end>
SourceLink = <
item
CapInsets.Left = 4.000000000000000000
CapInsets.Right = 4.000000000000000000
SourceRect.Left = 94.000000000000000000
SourceRect.Top = 30.000000000000000000
SourceRect.Right = 127.000000000000000000
SourceRect.Bottom = 62.000000000000000000
end
item
CapInsets.Left = 6.000000000000000000
CapInsets.Right = 6.000000000000000000
Scale = 1.500000000000000000
SourceRect.Left = 157.000000000000000000
SourceRect.Top = 45.000000000000000000
SourceRect.Right = 206.000000000000000000
SourceRect.Bottom = 93.000000000000000000
end
item
CapInsets.Left = 8.000000000000000000
CapInsets.Right = 8.000000000000000000
Scale = 2.000000000000000000
SourceRect.Left = 187.000000000000000000
SourceRect.Top = 57.000000000000000000
SourceRect.Right = 253.000000000000000000
SourceRect.Bottom = 121.000000000000000000
end
item
CapInsets.Left = 12.000000000000000000
CapInsets.Right = 12.000000000000000000
Scale = 3.000000000000000000
SourceRect.Left = 337.000000000000000000
SourceRect.Top = 93.000000000000000000
SourceRect.Right = 436.000000000000000000
SourceRect.Bottom = 189.000000000000000000
end>
TouchAnimation.Link = <>
end
object TLayout
StyleName = ‘content’
Align = Client
Locked = True
Margins.Left = 32.000000000000000000
Margins.Top = 4.000000000000000000
Margins.Right = 32.000000000000000000
Margins.Bottom = 4.000000000000000000
Size.Width = 0.000000000000000000
Size.Height = 42.000000000000000000
Size.PlatformDefault = False
end
object TColorObject
StyleName = ‘caretcolor’
Color = xFF222222
end
object TBrushObject
StyleName = ‘foreground’
Brush.Color = xFF222222
end
object TBrushObject
StyleName = ‘selection’
Brush.Color = x7F33B5E5
end
object TFontObject
StyleName = ‘font’
Font.Size = 18.000000000000000000
end
end

RHEdit_win.style
object TLayout
StyleName = ‘rheditstyle’
TabOrder = 16
object TActiveStyleObject
StyleName = ‘background’
Align = Contents
SourceLookup = ‘Windows 10 Desktopstyle.png’
ActiveTrigger = Focused
ActiveLink = <
item
CapInsets.Left = 7.000000000000000000
CapInsets.Top = 7.000000000000000000
CapInsets.Right = 7.000000000000000000
CapInsets.Bottom = 7.000000000000000000
SourceRect.Left = 266.000000000000000000
SourceRect.Top = 81.000000000000000000
SourceRect.Right = 305.000000000000000000
SourceRect.Bottom = 110.000000000000000000
end
item
CapInsets.Left = 10.000000000000000000
CapInsets.Top = 10.000000000000000000
CapInsets.Right = 10.000000000000000000
CapInsets.Bottom = 10.000000000000000000
Scale = 1.500000000000000000
SourceRect.Left = 399.000000000000000000
SourceRect.Top = 121.000000000000000000
SourceRect.Right = 457.000000000000000000
SourceRect.Bottom = 165.000000000000000000
end
item
CapInsets.Left = 14.000000000000000000
CapInsets.Top = 14.000000000000000000
CapInsets.Right = 14.000000000000000000
CapInsets.Bottom = 14.000000000000000000
Scale = 2.000000000000000000
SourceRect.Left = 532.000000000000000000
SourceRect.Top = 162.000000000000000000
SourceRect.Right = 610.000000000000000000
SourceRect.Bottom = 220.000000000000000000
end>
SourceLink = <
item
CapInsets.Left = 7.000000000000000000
CapInsets.Top = 7.000000000000000000
CapInsets.Right = 7.000000000000000000
CapInsets.Bottom = 7.000000000000000000
SourceRect.Left = 225.000000000000000000
SourceRect.Top = 81.000000000000000000
SourceRect.Right = 264.000000000000000000
SourceRect.Bottom = 110.000000000000000000
end
item
CapInsets.Left = 10.000000000000000000
CapInsets.Top = 10.000000000000000000
CapInsets.Right = 10.000000000000000000
CapInsets.Bottom = 10.000000000000000000
Scale = 1.500000000000000000
SourceRect.Left = 337.000000000000000000
SourceRect.Top = 121.000000000000000000
SourceRect.Right = 396.000000000000000000
SourceRect.Bottom = 165.000000000000000000
end
item
CapInsets.Left = 14.000000000000000000
CapInsets.Top = 14.000000000000000000
CapInsets.Right = 14.000000000000000000
CapInsets.Bottom = 14.000000000000000000
Scale = 2.000000000000000000
SourceRect.Left = 450.000000000000000000
SourceRect.Top = 162.000000000000000000
SourceRect.Right = 528.000000000000000000
SourceRect.Bottom = 220.000000000000000000
end>
TouchAnimation.Link = <>
end
object TLayout
StyleName = ‘content’
Align = Client
Locked = True
Margins.Left = 21.000000000000000000
Margins.Top = 4.000000000000000000
Margins.Right = 21.000000000000000000
Margins.Bottom = 4.000000000000000000
Size.Width = 0.000000000000000000
Size.Height = 42.000000000000000000
Size.PlatformDefault = False
end
object TButton
StyleName = ‘minusbutton’
Align = Left
CanFocus = False
Cursor = crArrow
Margins.Left = 2.000000000000000000
Margins.Top = 2.000000000000000000
Margins.Right = 2.000000000000000000
Margins.Bottom = 2.000000000000000000
Position.X = 2.000000000000000000
Position.Y = 2.000000000000000000
Size.Width = 20.000000000000000000
Size.Height = 46.000000000000000000
Size.PlatformDefault = False
StyleLookup = ‘spinbottombutton’
end
object TButton
StyleName = ‘plusbutton’
Align = Right
CanFocus = False
Cursor = crArrow
Margins.Left = 2.000000000000000000
Margins.Top = 2.000000000000000000
Margins.Right = 2.000000000000000000
Margins.Bottom = 2.000000000000000000
Position.X = 28.000000000000000000
Position.Y = 2.000000000000000000
Size.Width = 20.000000000000000000
Size.Height = 46.000000000000000000
Size.PlatformDefault = False
StyleLookup = ‘spintopbutton’
end
object TBrushObject
StyleName = ‘foreground’
Brush.Color = claBlack
end
object TBrushObject
StyleName = ‘selection’
Brush.Color = x7F2A96FF
end
object TFontObject
StyleName = ‘font’
end
end
end

Comments are closed.