View Full Version : Another crazy window handle question
04-11-2009, 01:42 AM
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?
04-11-2009, 08:48 AM
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.
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?
04-13-2009, 01:07 PM
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
04-13-2009, 05:35 PM
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:
04-13-2009, 06:00 PM
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 :)
04-16-2009, 12:17 AM
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 :D
04-16-2009, 12:27 AM
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 )
04-16-2009, 12:27 AM
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.