make some when element be deselected

make some when element be deselected

Anonymous
Not applicable
316 Views
1 Reply
Message 1 of 2

make some when element be deselected

Anonymous
Not applicable

Hi everyone

I have a window in my revit addin that has a PropertyGrid which shows the properties of a selected element and can change values. But when I click out of the element (I select a view or I click on the ribbon or menu or I click the Properties window Revit or any node in the project explorer) my PropertyGrid still loaded with information from the last item that I selected.

 

Is there any way to clean the PropertyGrid when I deselected an item? Or is there a command or option method in the API to do something when an item is deselected or click on another component?

 

Regards.

0 Likes
317 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk

Dear Marcosmateo,

 

I am not aware of any event being triggered on deselection... nor on selection, for that matter, unfortunately.

 

However, we did once implement a modeless selection watcher that could be used to implement what you are asking for based on the Idling event:

 

http://thebuildingcoder.typepad.com/blog/2010/09/selection-watcher-using-idling-event.html

 

I just notice it was recently reimplemented:

 

http://thebuildingcoder.typepad.com/blog/2015/03/element-selection-changed-event.html

 

However, as I have mentioned now and then, use of the Idling event is discouraged for things like this. 

 

You can implement the same thing with an external event instead.

 

http://thebuildingcoder.typepad.com/blog/2013/12/replacing-an-idling-event-handler-by-an-external-ev...

 

http://thebuildingcoder.typepad.com/blog/2013/12/triggering-immediate-external-event-execute.html

 

That gives you more control.

 

Cheers, Jeremy.



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes