Does anyone have any idea how to select an item (subnode) in a TreeView? For example, using the sample code below, how do you select the first child of node 1? Thanks for any assistance you might be able to provide!
Code: Select all#target photoshop
app.bringToFront();
var allItems = [
['one', 'one', 'two', 'three'],
['two', 'one', 'two', 'three'],
['three', 'one', 'two', 'three']
];
var dlg = new Window('dialog', 'Test');
var treeView = dlg.add('treeview', undefined, '', {scrolling: true});
treeView.preferredSize = [250, 250];
for (var i = 0; i < allItems.length; i++) {
var items = allItems;
var node = treeView.add('node', items[0]);
node.expanded = true;
for (var j = 0; j < items.length; j++) {
node.add('item', items[j]);
}
}
treeView.items[0].items[0].selected = true;
var buttons = dlg.add('group');
buttons.orientation = 'row';
buttons.alignment = 'right';
var okButton = buttons.add('button');
okButton.text = 'OK';
dlg.defaultElement = okButton;
var cancelButton = buttons.add('button');
cancelButton.text = 'Cancel';
dlg.cancelElement = cancelButton;
dlg.show();
How to select nested item (subnode) in TreeView?
How to select nested item (subnode) in TreeView?
From a scriptUI guide I've had a look at its not possible… But don't hold me to that…
How to select nested item (subnode) in TreeView?
I tried all the combinations that I could think of and nothing worked. Thanks for your input.
How to select nested item (subnode) in TreeView?
I just recall reading it in a guide… Using…
Code: Select alltreeView.selection = treeView.items[2];
Does preselect top level items could not get it to work lower down… This does NOT work for me when Photoshop is target get the white square in the corner yet again!!!
Code: Select alltreeView.selection = treeView.items[2];
Does preselect top level items could not get it to work lower down… This does NOT work for me when Photoshop is target get the white square in the corner yet again!!!
How to select nested item (subnode) in TreeView?
larsen67 wrote:This does NOT work for me when Photoshop is target get the white square in the corner yet again!!!
Yes, I think this is another example of ScriptUI not working in Photoshop CS5 as it should. I ran it a few times with Photoshop as the target and could see the treeview. But after several runs it now just shows a white dialog for me as well.
Yes, I think this is another example of ScriptUI not working in Photoshop CS5 as it should. I ran it a few times with Photoshop as the target and could see the treeview. But after several runs it now just shows a white dialog for me as well.
How to select nested item (subnode) in TreeView?
Thanks, guys; I appreciate the effort/feedback.
How to select nested item (subnode) in TreeView?
Mike, Im convinced there is a problem with Photoshop + scriptUI. This has got to be the 3rd or 4th occasion where I've ran in to issues that just don't happen with other apps in the suite… Thats part of the reason for my questions on changing 'themes' etc. to see if I could get around it…
The OMV says…
selection ListItem r/w
The currently selected list item.
Setting this value causes the selected item to be highlighted and to be scrolled into view if necessary. If no items are selected, the value is null. Set to null to deselect all items.You can set the value using the index of an item, rather than an object reference. If set to an index value that is out of range, the operation is ignored. When set with an index value, the property still returns an object reference.
I could not get the subitems to work though… But that could just be me…
The OMV says…
selection ListItem r/w
The currently selected list item.
Setting this value causes the selected item to be highlighted and to be scrolled into view if necessary. If no items are selected, the value is null. Set to null to deselect all items.You can set the value using the index of an item, rather than an object reference. If set to an index value that is out of range, the operation is ignored. When set with an index value, the property still returns an object reference.
I could not get the subitems to work though… But that could just be me…