Label as custom TreeViewItem (showEditor())


#1

Is there a way of having TreeViewItem::createItemComponent() return a Label component with its editor showing?

Calling showEditor() in createItemComponent() has no effect because the label has no parent and can’t take focus.

I’d like new items in my tree to be ready to receive names from the user.


#2

Don’t forget that those components can be created at any time - e.g. when the treeview gets resized and needs more rows, when it scrolls, etc., so are you sure you want the label to always appear?

But I guess what I’d do would be to use the parentHierarchyChanged callback to show the editor when it gets put on the screen.


#3

It’s a drag target too, so unfortunately, yes.

[quote]
But I guess what I’d do would be to use the parentHierarchyChanged callback to show the editor when it gets put on the screen.[/quote]

That’s workable. Cheers.