Weird Firemonkey TTreeViewItems....

Weird Firemonkey TTreeViewItems....

I'm trying to derive from TTreeViewItem, like:

type
TParentTreeViewItem = class(TTreeViewItem)
end;

TChildTreeViewItem = class(TParentTreeViewItem)
end;

....

Then in the FormCreate, instantiate them:

procedure TForm1.FormCreate(Sender: TObject);
var
aTI: TTreeViewItem;
aPI: TParentTreeViewItem;
aCI: TChildTreeViewItem;

begin
aTI := TTreeViewItem.Create(Self);
aTI.Text := 'TreeViewItem';

aPI := TParentTreeViewItem.Create(Self);
aPI.Text := 'ParentTreeViewItem';

aCI := TChildTreeViewItem.Create(Self);
aCI.Text := 'ChildTreeViewItem';

TreeView1.AddObject(aTI);
TreeView1.AddObject(aPI);
TreeView1.AddObject(aCI);
end;

'aTI' and 'aPI' both display as expected, but 'aCI' is added to the tree, but no text is displayed.

Am I doing some something wrong here?

Cheers

Vince

Comments

  1. Shortening the class name makes no difference (unless 3 character class names are too long ;) )

    I'd have thought the depth of inheritance shouldn't have made any difference, but as David said, it seems it does.

    And it does exactly the same on Android.

    ReplyDelete
  2. It's hard to search for it but I'm sure I've seen some posts on SO about that issue.

    ReplyDelete

Post a Comment