I seem to remember reading about a DC attribute that we can attach to a Component Definition to hide it in the Components window. But after an extensive search both here and on Google, I can’t find anything.
Did I dream it? Maybe I’m just mixing things up with the definition.hidden?…
Yea, there is something that was added for Dynamic Components:
// A Dynamic component can set a _hideinbrowser attribute == true
// to keep a definition fron showing in the Component Browser.
```ruby
definition.set_attribute('dynamic_attributes', '_hideinbrowser', true)
(Note that this is something of an internal implementation detail. But it sounds reasonable to me if the API had an official method to do this.)
On that topic I just realized we have internal? and hidden? for definitions. And it wasn’t clear to me what they meant.
The hidden method is used to determine if this component definition should be hidden on the component browser.
The source code comment says:
// A component is "hidden" if all of its instances are within
// other external component definitions. Conversely a component
// is "visible" if it has no instances, or has any instances
// within the model or within any internal component definitions.
// Note that we use "GetHidden" to differentiate this from the
// method on CDrawingElement.
This method checks if the definition has zero instances and that all its instances are within another definition. It also checks if the definition is “internal”.