Skip to content

Commit

Permalink
Changed LoadFromResource to a function
Browse files Browse the repository at this point in the history
  • Loading branch information
DelphiWorlds committed Jul 24, 2023
1 parent cc23061 commit 8a8a407
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Core/DW.StyleHelpers.pas
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ TStyleBookHelper = class helper for TStyleBook
/// <summary>
/// Loads a stylebook from a resource compiled (default name: StyleBook) into the application
/// </summary>
procedure LoadFromResource(const AResourceName: string = '');
function LoadFromResource(const AResourceName: string = ''): Boolean;
end;

TStyleResource = record
Expand Down Expand Up @@ -60,11 +60,12 @@ implementation

{ TStyleBookHelper }

procedure TStyleBookHelper.LoadFromResource(const AResourceName: string = '');
function TStyleBookHelper.LoadFromResource(const AResourceName: string = ''): Boolean;
var
LStream: TStream;
LResourceName: string;
begin
Result := False;
if LResourceName.IsEmpty then
LResourceName := cStyleBookResourceNameDefault
else
Expand All @@ -74,6 +75,7 @@ procedure TStyleBookHelper.LoadFromResource(const AResourceName: string = '');
LStream := TResourceStream.Create(HInstance, LResourceName, RT_RCDATA);
try
LoadFromStream(LStream);
Result := True;
finally
LStream.Free;
end;
Expand Down

0 comments on commit 8a8a407

Please sign in to comment.