Goedendag,
Momenteel probeer ik een eigen component te maken op basis van TButton, aan de hand van de handleiding van Embarcadero zelf. (Let er op dat de docwiki offline is, hij is ook te vinden in de offline help files)
Het probleem is echter het stukje code:
Code:
function TDialogButtonPanel.GetStyleObject: TControl;
const
Style = 'MyPanelButtonsStyle';
begin
if (FStyleLookup = '') then
begin
Result := TControl(TStyleManager.LoadFromResource(HInstance, Style,
RT_RCDATA));
Exit;
end;
Result := inherited GetStyleObject;
end;
Voor TButton wordt deze function GetStyleObject: TFmxObjtect, maar het probleem is dat FStyleLookup een private field zijn van TStyledControl en ik er dus helemaal niet bij mag.
Mijn vraag is dus: hoe moet dit dan wel? Hoe zorg je er correct voor dat een style in een BPL gevoegd wordt?
Mijn code:
Code:
unit UMyButton;
interface
uses
System.SysUtils, System.Classes, FMX.Types, FMX.Controls,
FMX.Controls.Presentation, FMX.StdCtrls;
type
TMyButton = class(TButton)
private
{}
protected
function GetStyleObject: TFmxObject; override;
public
{ Public declarations }
published
{}
end;
procedure Register;
implementation
{$R *.res}
procedure Register;
begin
RegisterComponents('Additional', [TMyButton]);
end;
{ TMyButton }
function TMyButton.GetStyleObject: TFmxObject;
const
Style = 'MyButtonStyle';
begin
if (FStyleLookup = '') then
begin
Result := TControl(TStyleManager.LoadFromResource(HInstance, Style, RT_RCDATA));
Exit;
end;
Result := inherited GetStyleObject;
end;
Bookmarks