Attributes
Files
- ComponentComboPlusButtonAttributes.cs
This file defines a custom Grasshopper component attribute class, `ComponentComboPlusButtonAttributes`, which extends `GH_ComponentAttributes` to enhance the visual interface of a component. It adds two interactive UI elements: an organization selector capsule and a primary action button, dynamically resizing the component based on authentication status and content width. The `Layout` method calculates bounds for these elements, while `Render` draws them using Grasshopper’s capsule rendering utilities. User interactions are handled by overriding `RespondToMouseDown`, which triggers a custom event for the button click or displays a context menu for selecting among multiple organizations. This customization allows users to switch organizational contexts directly from the component canvas, automatically expiring solutions to reflect changes.
- ComponentOneButtonAttributes.cs
This file defines a custom Grasshopper component attribute class named `ComponentOneButtonAttributes` that extends the standard `GH_ComponentAttributes`. Its primary purpose is to render a clickable button directly on the canvas interface, allowing users to interact with a component via a UI element. The key components include event handling for mouse clicks (`RespondToMouseDown`) and a public event (`ButtonPressed`) that notifies listeners when the button is activated. The layout logic dynamically adjusts the component's bounding box to accommodate the button, while the rendering method draws a styled capsule representing the button text. This enables seamless integration of interactive buttons within Grasshopper’s visual programming environment.