[Lazarus] Custom component: cannot make Items: TStrings
Vojtěch Čihák
vojtech.cihak at atlas.cz
Sat Sep 30 19:20:31 CEST 2017
Hi,
you have unusual getter:
function TATTabs.GetItems: TStrings;
var
D: TATTabData;
i: integer;
begin
Result:= TStringList.Create;
for i:= 0 to TabCount-1 do
begin
D:= GetTabData(i);
if Assigned(D) then
Result.Add(D.TabCaption)
else
Result.Add('?');
end;
end;
IMO, when you run app, ATTabs should read Items from *.lfm. But it creates new instance of TStringList instead. New instance is created from existing tabs, therefore it is empty. Even more, you don't Free then TStringList anywhere, there will be many instantioned Results.
I'm not sure with solution, maybe you test csLoading somewhere.
V.
______________________________________________________________
> Od: Alexey via Lazarus <lazarus at lists.lazarus-ide.org>
> Komu: lazarus mailing list <lazarus at lists.lazarus-ide.org>
> Datum: 30.09.2017 18:42
> Předmět: [Lazarus] Custom component: cannot make Items: TStrings
>
Hi. I added to ATTabs prop Items: TStrings. It has getter/setter. It has
registering in IDE.
- in designer, OI can set Items and tabs appear
- if i run app, tabs dont appear- ??
- if I restart IDE, app's LFM looses Items- ??
https://github.com/alexey-t/attabs <https://github.com/alexey-t/attabs>
--
Regards,
Alexey
--
_______________________________________________
Lazarus mailing list
Lazarus at lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus <https://lists.lazarus-ide.org/listinfo/lazarus>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170930/7559ff82/attachment.html>
More information about the Lazarus
mailing list