Notifications
Clear all

[Closed] Another crazy window handle question

So I have a plugin that has a rollout that contains a treeView control. I want to be able to select an item in the treeView through maxscript. Digging through the MSDN I found the TVM_SELECTITEM message, which seems like what I need, but the lParam calls for a handle to the treeView item to be selected. I have no idea how, or if it’s even possible to get the handle of individual items in the tree view. Calling the windows.getChildrenHWND #max, I can find the treeView itself, just none of it’s children. Any ideas?

7 Replies

no such luck – you can’t construct the TVItem structure for the windows message to use (from which you would then get hItem). see if you can use keyboard commands to navigate to a specific branch/leaf, or use an external application/method.

 PEN

I don’t fully follow what you are trying to do, select a tree view node in Max? How? With a mouse click on it? Some other method? Have you seen the help on treeview on my site?

http://www.paulneale.com/tutorials/dotNet/treeView/dotNetTreeView.htm

If it’s a plugin implementing the tree view (and not his own scripted plugin using a .net treeview control), then the dotnet access isn’t going to be of much help

Exactly, it’s a plugin that’s not my own. I’m trying to automate the creation and setup of objects in the scene. Unfortunately, since the properties I need are not exposed directly through maxscript, my only alternative is to use the UIAccessor and windows struct to find and fill out the proper controls within the plugin rollout itself. :banghead:

another option is to try and get the developer to expose the methods you need… but if they have no interest in doing so… again, see if navigating the treeview by keyboard is an option… if not – have a peek at programs like AutoIt; I haven’t checked if you can do a ‘select by string’ type thing with it on TreeViews, but your odds are better there, at least

Just got back to this, and navigating with the keyboard works. I found your example for navigating the modifier stack, and using the same WM_KEY messages on the treeview works out great! Thanks Richard

excellent – glad it worked out in this case

( won’t always… e.g. if the number of branches/leaves vary; as you always need to know the exact number of keypressed… yum )