Thanks @dale. I should have explained a bit why i need this as individual property:
I am working on a custom dialog which is similar to the built in Layer dialog but also displays objects and some of their properties. This dialog should run in sync with Rhino’s built in Layer dialog. Therefore i am trying to query if a layer is current, hidden, locked, selected, unselected, deleted, undeleted, renamed etc. Some of these properties can be queried on a per layer basis, some using events (adding, renaming, deleting, sorting, attribute changes etc.), some others are simply not available.
Tracking changes made in the built in layer dialog might be accomplished by using layer events, which alone turns out to be a large project as events are fired multiple times for a single operation. Tracking changes in my dialog is done using my own events.
All tracking runs recursive and special caution is required to prevent event bubbling. After working on this project for a while i realized this is a huge task and there are required bits missing in the API eg:
A method to get & set the selection state on a per layer basis (how to unselect ?)
An event which gets fired if the layer selection changes.
Since layers are mostly accessable index based, i realized that changing the layer order in the built in Layer dialog is problematic. Eg.
scriptcontext.doc.Layers does not return the layers in the display order, so i need to sort using
layer.SortIndex to stay in sync with that. All these hurdles require a lot of iteration which i have to do in both dialogs after every change to keep both dialog contents visually in sync. But all of this only makes sense if i can notice changes made in both dialogs.
Back to my inital question, is
layer.ComponentStatus a way to
set the selection and why does it return a “Clear” state when the layer is selected ?