Thanks, both works!
BTW:
function TBaseElFPGObjList.GetItembyIdx(AIdx: Integer): T;
var i: Integer;
begin
for i:=0 to Count-1 do
if Items[i].Idx=AIdx then
begin
Result:=Items[i];
exit; { Exit! }
end;
Result:=T(nil); //<-- is this normal?
end;
I've never seen retyping nil to T. Without it I got "Error: Incompatible types: got "Pointer" expected "$gendef112"".
Anyway, I have to dive deeper to generics, it's fun
This is one of those rare occasions that our benevolent ruler of the universe (Florian) made a very recent "fix" that in my opinion is avoiding the problem.
I am not prepared to discuss the issue, since he decided.
For more info:
https://bugs.freepascal.org/view.php?id=33961 and use mantis to see how Florian solved it (as opposed to Michael, who fixed the docs).
My opinion is that is is too relaxed, way too relaxed and goes against type-safety. Docs are OK.
(BTW: beautiful components, again...)
And YES, generics are fun.
(Actually this will confuse people - so if your are not Blaazen, keep your mouth shut- )