Tree Browser Menu

Tree Browser Menu

Anonymous
Not applicable
739 Views
7 Replies
Message 1 of 8

Tree Browser Menu

Anonymous
Not applicable
In the Tree Browser that was added in R8, is there a easy way to build node specific context menu's? I have only added one item to a context menu before and as I remember it was a bit of a hassle, and we were restricted to our addition being the last item on the menu. Has this changed? -- Kent Keller http://www.KWiKMcad.com Autodesk Discussion Group Facilitator
0 Likes
740 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
I am nearing a point that it would be hard to switch from the MS TreeView to the built in Tree Browser. It would really help to make the decision if I knew what was involved (or if it is even possible) in making node specific context menu's for the Tree Browser. Any help greatly appreciated. -- Kent Autodesk Discussion Group Facilitator "Kent Keller" wrote in message news:404bdc36_2@newsprd01... > In the Tree Browser that was added in R8, is there a easy way to build > node specific context menu's? I have only added one item to a context > menu before and as I remember it was a bit of a hassle, and we were > restricted to our addition being the last item on the menu. Has this > changed? > > -- > Kent Keller > http://www.KWiKMcad.com > > Autodesk Discussion Group Facilitator > >
0 Likes
Message 3 of 8

Anonymous
Not applicable
Kent, The basic workflow for handling context menus in Inventor is to listen to the OnContextMenu event which is available from the UserInputEvents object, which you get from the CommandManager object. This event is fired just before any context menu is displayed. The event passes you the context menu that is about to be displayed as a CommandBar object. You can look at the contents of the SelectSet to see what the context menu is being displayed for. If it's an object that your interested in, (in your case a specific browser node), you can then remove and/or add controls to the command bar. Once you've finished Inventor will display the modified command bar. If you've added a button for a command of your own and the user clicks it, you'll recieve the OnClick event for that command and can do whatever you want at that point. In deciding whether to use the standard tree control or the browser tree depends a lot of your specific application. If the tree is being used to display data that is not directly represented by graphics in Inventor the I would lean towards using the standard tree control. -- Brian Ekins Developer Technical Services, Autodesk Discussion Q&A: http://www.autodesk.com/discussion "Kent Keller" wrote in message news:404dfe69$1_2@newsprd01... > I am nearing a point that it would be hard to switch from the MS TreeView to the built in > Tree Browser. It would really help to make the decision if I knew what was involved (or > if it is even possible) in making node specific context menu's for the Tree Browser. > > Any help greatly appreciated. > > -- > Kent > Autodesk Discussion Group Facilitator > > > "Kent Keller" wrote in message news:404bdc36_2@newsprd01... > > In the Tree Browser that was added in R8, is there a easy way to build > > node specific context menu's? I have only added one item to a context > > menu before and as I remember it was a bit of a hassle, and we were > > restricted to our addition being the last item on the menu. Has this > > changed? > > > > -- > > Kent Keller > > http://www.KWiKMcad.com > > > > Autodesk Discussion Group Facilitator > > > > > >
0 Likes
Message 4 of 8

Anonymous
Not applicable
Thanks Brian I think I will give it a shot and see if I can get it figured out. Unfortunately this is my first time trying to do something in the Browser, and I am a little confused on how to remove a pane from the browser. In the sample from the Developers site, I added a sub that just had oPane.Delete. This seems to remove the pane from Display, but it is still a item in the BrowserPanes properties, so when I try to run the creation code again, it fails. What is the proper way to delete a browser pane? -- Kent Autodesk Discussion Group Facilitator "Brian Ekins (Autodesk)" wrote in message news:404e0a11_3@newsprd01... > Kent, > > The basic workflow for handling context menus in Inventor is to listen to > the OnContextMenu event which is available from the UserInputEvents object, > which you get from the CommandManager object.
0 Likes
Message 5 of 8

Anonymous
Not applicable
I don't even seem to be able to get a browser Tree to display using a addin. Here is the basic button click event I have tried to use. It gets to the Set oAssemResource line and fails with a message that just says Method add of object failed. I have tried loading the image like the example using a image box on a form, but it didn't help. I have tried various other numbers instead of 10 (not really sure I understand what this number is for) but that didn't help. If I put a watch on odoc.BrowserPanes it lists all the ones already loaded. Anyone else used this control in a addin yet? Any help appreciated. 8^) Set odoc = oApp.ActiveDocument Dim img As IPictureDisp Set img = LoadResPicture(101, vbResIcon) Set oAssemResource = odoc.BrowserPanes.ClientNodeResources.Add("KWiKTest", 10, img) Set oAssemDef = oBPs.CreateBrowserNodeDefinition(odoc.DisplayName, 1, img) Set oPane = oBPs.AddTreeBrowserPane("KWiKTest", "KWiKTest", oAssemDef) -- Kent Autodesk Discussion Group Facilitator "Brian Ekins (Autodesk)" wrote in message news:404e0a11_3@newsprd01...
0 Likes
Message 6 of 8

Anonymous
Not applicable
Just figured out it works if I am not in Debug mode. I am hoping it is just because I am doing something wrong... otherwise it could be impossible to debug. -- Kent Autodesk Discussion Group Facilitator "Kent Keller" wrote in message news:404e333e$1_1@newsprd01... > I don't even seem to be able to get a browser Tree to display using a addin.
0 Likes
Message 7 of 8

Anonymous
Not applicable
I believe the problem in this case is because of the pictures. There is a limitation with the Automation interface that the object (IPictureDisp) that represents the picture cannot be passed between two processes. When you're debugging VB and your Add-In are running in a seperate process to Inventor. I just looked at the various browser tree related methods and the Add method of ClientNodeResources requires you to provide the icon. This method cannot work across process boundaries. With the way it is now, you cannot debug an Add-In that uses a the browser tree. I talked to the developers and this was an oversight. They plan to provide some type of workaround that will allow you to debug these in the future. For now the only option is to not use the browser tree at all or debug this portion of your code in VBA. VBA runs in the same process as Inventor, so it works ok. I expect the first option is the most palatable at this time. -- Brian Ekins Developer Technical Services, Autodesk Discussion Q&A: http://www.autodesk.com/discussion "Kent Keller" wrote in message news:404e38a7$1_2@newsprd01... > Just figured out it works if I am not in Debug mode. I am hoping it is just because I am > doing something wrong... otherwise it could be impossible to debug. > > -- > Kent > Autodesk Discussion Group Facilitator > > > "Kent Keller" wrote in message news:404e333e$1_1@newsprd01... > > I don't even seem to be able to get a browser Tree to display using a addin. > >
0 Likes
Message 8 of 8

Anonymous
Not applicable
Thanks Brian Glad to hear it wasn't just me goofing up ;^) It seems like it would be really nice if you could set the Tree to use a Imagelist like a normal tree. I suppose that might have the same problem debugging? but would be a little nicer way to deal with all the icons. -- Kent Keller http://www.KWiKMcad.com Autodesk Discussion Group Facilitator "Brian Ekins (Autodesk)" wrote in message news:404e6fce$1_2@newsprd01... > I believe the problem in this case is because of the pictures. There is a > limitation with the Automation interface that the object (IPictureDisp) that > represents the picture cannot be passed between two processes. When you're > debugging VB and your Add-In are running in a seperate process to Inventor.
0 Likes