API: Deselecting from FM tree

Has anyone else dealt with this. I created a few programs that have residual selections (meaning you select an item it is added to a list and then you can select another with out holding CTRL, then you deselect by clicking on any selected item, and it is removed from the list.) The problem is that when deselecting a feature from the Tree it seems to raise the Assm_SelectionChangeNotify event 2 times. This is causing my app to loop and deselect everything. When deselecting from the graphics view everything works as expected. I have been racking my brain trying to think of some other way of deciding which item was deselected. I have been using....

Set ThisComp = SelMan.GetSelectedObjectsComponent2(SelMan.GetSelectedObjectCount)

to get the last object selected. Then I check if it is in my list and if the item is found it removes the item if not it adds the item.

Anyone have any Ideas they would like to share.

Corey

Reply to
CS
Loading thread data ...

Corey,

I have not run into this problem, but you could solve it using an old programmer's trick.

Set up a global boolean variable called FirstTime and set it equal to true. Then, after the first time, set it equal to what ever it is not. Then, only run your code if FirstTime is true. Just make sure you set FirstTime back to true after your desired code runs?

Does that make sense?

Evan

Reply to
Evan T. Basalik

I know what you are saying and I already have that in there but my problem is when it is deselecting from the FM tree SW calls the selectionchange event lets it run all the way through so my FirstTime switch is set to false and back to true, then SW calls selection change again. I can't figure out anyway to stop it. I e-mailed API support but they haven't responded yet.

Corey

Reply to
CS

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.