Edit TreeView cell?

Just curious – Is there a way to edit TreeView cells like it was a spreadsheet?

Still on my long, backburned path to make a “tracker” input for SC with midi input.

Also – I hope no on feels obligated to write a bunch of code for their response. I am mostly curious, hoping for a pointer to docs if it’s possible.

Yes, by putting NumberBox views in the cells, for example:

(
t = TreeView().front;
t.columns_(["one", "two", "three"]);
t.addItem(["Alice", "Anna", "Anders"]);
t.addItem(["Bob", "Beatrice", "Benny"]);
t.addItem(["Cleo", "Conrad", "Cecilia"]);

i = t.itemAt(1);  //get an item

i.setView(0, NumberBox());
i.setView(1, NumberBox());
i.setView(2, NumberBox());
i.view(1).value_(44);
i.view(2).value_(99);
)

see: TreeViewItem | SuperCollider 3.12.2 Help

Oh that’s fantastic, thank you!

Is the paradigm to fill the TreeView with Qt views as you might need? For the tracker project, I would want to use text strings, maybe with a validation thing.

I would also need to process all the data within the TreeView items into a single array of arrays that could drive a sequence, but that just seems like some looping and coding.

ty!

That sound right. You can add actions to the views to get the behaviour you want:

(
t = TreeView().front;
t.columns_(["one", "two", "three"]);
t.addItem(["Alice", "Anna", "Anders"]);
t.addItem(["Bob", "Beatrice", "Benny"]);
t.addItem(["Cleo", "Conrad", "Cecilia"]);

i = t.itemAt(1);  //get an item

i.setView(0, TextField());
i.setView(1, NumberBox());
i.setView(2, NumberBox());
i.view(0).string_("text...");
i.view(1).value_(44);
i.view(2).value_(99);
i.view(0).action_({arg view; view.string.postln;});
i.view(1).action_({arg view; view.string.postln;});
i.view(2).action_({arg view; view.string.postln;});
)