issue catching events

Discussion created by castormalin on Oct 6, 2010

I'm developing a plug-in that creates a layer. Many layers can be created sharing an HMI for user entry.

I use IActiveViewEvents to catch add/delete events. I store the id of the layers, and the HMI can act only on the layers that are showed.
That works pretty well, anyway, I have some issues :

- if my layer is created inside a data frame or a layer group and when I delete the data frame or the layer group, my layer doesn't receive a delete event. Then I should catch the "delete data frame event" and the "delete layer group event". Is it possible to read the id of a layer (the one that is given when the event ItemAdded(VARIANT Item) is received), and of a map ?

- when I load the layers using IPersistVariant, when the load method is called, the ICommand that I take the IMxDocument object from isn't yet initialised, so I can't wire to IActiveViewEvents. Then as these layers don't receive an AddLayer event, I don't have their id. Then is it possible to have the IMxDocument object by another method ?