Expressions/Scripts/Presets

Moderator: Paul Tuersley

 
SpencerT
Topic Author
Posts: 8
Joined: Mon Mar 29, 2010 5:08 pm

Treeview multiselect?

Fri Jul 01, 2016 7:01 pm

Hey guys,

I'm working on an import panel very similar to Immegration by Lloyd Alvarez: http://aescripts.com/immigration/. If I succeed I'll definitely be posting it up for free!

What I'm trying to do is multi-select a treeview, which I can't seem to do by default. I've been digging around the javascript tools guide and I think it is possible with some manual handiwork or perhaps a workaround, but I'm sure other devs have run into this before so I thought I'd throw the question out there before I started getting too crazy with it. So anyone do this already?

To be specific the user feeds in a root folder and my script recursively drills through and builds up a treeview hierarchy of all sub-folders and image sequences (example screenshot attached). Now I want the user to be able to select folders/items from the treeview and hit "import". Simple enough right?

- Spencer
Attachments
Capture.PNG
screen cap of treeview
Capture.PNG (18.93 KiB) Viewed 1322 times
 
beginUndoGroup
Posts: 77
Joined: Tue Nov 27, 2012 6:41 am

Re: Treeview multiselect?

Mon Jul 04, 2016 5:23 am

You need to specify "multiselect: true" in the properties object of the treeview:

myTree = myGroup.add("treeview{properties:{multiselect: true}}");

or :

myTree = myGroup.add("treeview", undefined, undefined, {multiselect: true});

(it must be specified upon creation and cannot be modified afterwards).

Xavier
 
SpencerT
Topic Author
Posts: 8
Joined: Mon Mar 29, 2010 5:08 pm

Re: Treeview multiselect?

Mon Jul 04, 2016 3:55 pm

Hey Xavier,

Thanks for the reply but this isn't working. I know that works for listboxes but when I try it for treeview it doesn't throw an error, but also just doesn't work... Ugh extenscript gets frustrating at times.

Let me know if I'm doing anything wrong but I pretty much just copied your code. Mine looks like this:

var imageSequenceTree = imageSequenceGroup.add("treeview", [0,0,350,400], undefined, {multiselect: true});

- Spencer
 
beginUndoGroup
Posts: 77
Joined: Tue Nov 27, 2012 6:41 am

Re: Treeview multiselect?

Tue Jul 05, 2016 11:00 am

Hi again, i tried my suggestion and you right, it doesnt work.
From the ScriptUI object model viewer in ESTK, treeviews creation properties do not include "multiselect" (listboxes do), so it might very well be that they are not supposed to accept multiple selections...

Xavier
 
SpencerT
Topic Author
Posts: 8
Joined: Mon Mar 29, 2010 5:08 pm

Re: Treeview multiselect?

Tue Jul 05, 2016 2:07 pm

This is quite frustrating, I don't know why Adobe would want to bar you from multiselecting a treeview... I filed a feature request, who knows they might add it to a future release (or just support python already!).

I have an idea for a workaround - double-click does work for treeviews so I'll just build a separate listbox of all items you want to import and the user can double-click any sequences he needs, to drop them into the listbox. Clean and simple, but a little more clunky than multi-select...

Btw do you know how to access the items of the treeview? Sounds stupid but I can only get the root item by querying myTreeView.items. I'm sure that the treeview builds an array of all elements but how the hell do you get to it? I've looked everywhere in the javascript tools guide but it only mentions the .items method.

*sigh*

- Spencer
 
SpencerT
Topic Author
Posts: 8
Joined: Mon Mar 29, 2010 5:08 pm

Re: Treeview multiselect?

Tue Jul 05, 2016 5:47 pm

Whew, got a v1.0 done! If anyone wants it here you go. I haven't done a lot of testing but it is working so far! I'll be building in more features, functionality and optimization as I go.

Just double-click the image sequence to import and it will drop into the bottom panel, which is a list of items that get imported. If you want to remove something from the bottom panel just double-click it.

- Spencer
Attachments
ST_Import Panel.zip
(1.96 KiB) Downloaded 65 times

Who is online

Users browsing this forum: No registered users and 2 guests