Reputation: 149
I am building a firemonkey mobile application.
I have gone to projects -> Resources and Images.
Added "statusled.png" and the identifier is "LedOff" type "RCDATA"
In my form2.FormShow procedure I have this:
var
offLed: TBitmap;
implementation
procedure TForm2.FormShow(Sender: TObject);
var
jsonObj: TJSonObject;
T: TResourceStream;
litem: TListViewItem;
begin
T := TResourceStream.Create(HInstance, 'LedOff', 'RT_RCDATA');
offLed.Create;
offLed.LoadFromStream(T);
end;
When I run this and form2 opens I get "Resource LedOff not found" why is this?
Upvotes: 1
Views: 932
Reputation: 613481
The resource type should not be quoted:
T := TResourceStream.Create(HInstance, 'LedOff', RT_RCDATA);
Note that offLed.Create
looks very dubious. I suspect that should read offLed := TSomeClass.Create
where TSomeClass
might be TBitmap
, but only you can tell for sure.
Upvotes: 2