Delphi 10.1 BerlinでTGridを継承したクラスを作成するには
Delphi 10.1 BerlinでTGridを継承した次のようなクラスを作成しました。
type
TMyGrid = class(TGrid)
end;
ところが実行すると、次のようなメッセージが表示されます。
クラス TMyGrid に対して TStyledPresentationProxy の下位クラスが登録されていません。
おそらく uses セクションに FMX.Grid.Style モジュールを追加する必要があります。
TMyGridと同じユニットに次のコードを追加することで解決しました。
uses
FMX.Presentation.Factory,
FMX.Presentation.Style;
initialization
TPresentationProxyFactory.Current.Register(
TMyGrid,
TControlType.Styled,
TStyledPresentationProxy<TStyledGrid>);
finalization
TPresentationProxyFactory.Current.Unregister(
TMyGrid,
TControlType.Styled,
TStyledPresentationProxy<TStyledGrid>);