View Full Version : querying treeview items

03 March 2009, 02:22 AM
string $window = `window`;
string $layout = `formLayout`;
string $control = `treeView -parent $layout -numberOfButtons 3 -abr false`;

formLayout -e
-attachForm $control "top" 2
-attachForm $control "left" 2
-attachForm $control "bottom" 2
-attachForm $control "right" 2

showWindow $window;
$a=`treeView -edit -addItem "layer 1" "" $control`;

and now attempting to query it via :

treeView -q -itemIndex "layer 1" $control

Error : Object not found: layer 1.

how can I learn the item index of item "layer 1"?

(thanks before any suggestions)

03 March 2009, 05:30 PM
I am getting no results on this issue either. The presscallback from the maya docs is broken as well. This is the first time I have seen this control, as far as I can tell it is broke.

the error results say Object not found when it should never be looking for an object. if you leave the string blank it will throw an error that says " Error: line 1: Item '' was not found in the treeview" which is what we should get if it was merely an incorrect layer name.

if anyone else discovers a solution to this I would be interested too, this is going to be nagging me all week.

03 March 2009, 08:24 PM
thanks door for interest

very weird but :
treeView -itemIndex "layer 1" -q $control

03 March 2009, 08:28 PM
ah very nice! :beer:

there are a couple command flags that act differently when placed before or after the -query flag but all the ones I am aware of point out these differences in the maya docs. guess this one slipped through the cracks.

CGTalk Moderation
03 March 2009, 08:28 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.