# ColumnsNode
Class Inherits TableNode
## About
`ColumnsNode` is a horizontal container of independently editable columns. It defaults to two columns, accepts rich text or embedded child nodes in each column, and permits adding and removing columns from its popover toolbar.
## Methods
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| ActionItem | index As Integer | ToolbarItem | Returns the contextual toolbar item at the specified index. |
| AddColumn | (None) | (None) | Adds a column and rebalances the column percentages. |
| AddNode | column As Integer <br> node As Node | (None) | Adds node to this columns node. |
| BeginPointerInteraction | x As Double <br> y As Double | Boolean | Begins resizing the column divider at the suppplied document coordinates. |
| CanImportHTML | element As GraffitiProEditor.HTMLSupport.HTMLElement | Boolean | Returns whether this node type can import the supplied HTML element. |
| Column | index As Integer | TextSnapshot | Returns the content snapshot for the specified zero-based column. |
| ColumnOffset | column As Integer <br> totalWidth As Double | Double | Returns the horizontal offset of the specified column within the supplied total width. |
| ColumnPercentage | index As Integer | Double | Returns the percentage width of the specified zero-based column. |
| ColumnPercentages | (None) | Double | Returns a copy of the column widths as percentages. |
| ColumnWidth | column As Integer <br> totalWidth As Double | Double | Returns the rendered width of the specified column within the supplied total width. |
| Constructor | columnCount As Integer = 2 | (None) | Creates a new columns node instance initialized from the supplied values. |
| ContinuePointerInteraction | x As Double <br> y As Double | Boolean | Continues resizing the active column divider and returns whether the widths changed. |
| Duplicate | (None) | Node | Returns an independent copy of this node and its configurable state. |
| EndPointerInteraction | (None) | (None) | Ends the active column-divider resize interaction. |
| ExportStyles | stylesheet As GraffitiProEditor.Stylesheet | (None) | Adds the stylesheet rules this node type's HTML output uses. |
| FromHTML | element As GraffitiProEditor.HTMLSupport.HTMLElement | Boolean | Imports supported content and formatting from an HTML element and returns whether it succeeded. |
| FromJSON | data As JSONItem | Boolean | Restores a columns node from JSON. |
| HTMLImportPriority | element As GraffitiProEditor.HTMLSupport.HTMLElement | Integer | Returns this node type's priority when resolving an HTML element importer. |
| HTMLTags | (None) | String | Returns the HTML tag names supported by this node type. |
| InspectorSections | (None) | InspectorSection | Returns the user-editable column layout properties exposed by the inspector. |
| LastActionIndex | (None) | Integer | Returns the last zero-based action index supplied by this node, or -1 when there are no actions. |
| LocalizeToolbarItem | strings As GraffitiProEditor.Editor | (None) | Sets this node type's toolbar item text from the supplied editor's localization properties. The editor calls it when the type is registered, when the editor opens, and when a locale pack is applied to the editor. A custom node type can override it to localize its own toolbar item. |
| PerformAction | index As Integer <br> selectedItem As DesktopMenuItem | (None) | Handles the contextual toolbar action at the specified index. |
| PerformToolbarAction | editor As Editor <br> selectedItem As DesktopMenuItem | (None) | Handles activation of this node type's main-toolbar item. |
| PointerCursorAtPoint | x As Double <br> y As Double | MouseCursor | Returns the native horizontal resize cursor when the pointer is over a column divider. |
| RemoveColumn | (None) | (None) | Removes the active column and rebalances the remaining column percentages. |
| RenderSelectionOverlay | g As Graphics | (None) | Draws the columns selection overlay and any active resize divider. |
| RestoreHTMLChildren | element As GraffitiProEditor.HTMLSupport.HTMLElement | (None) | Restores embedded nodes in each column from HTML. |
| SetColumnPercentage | index As Integer <br> percentage As Double | (None) | Sets the percentage width of a column and proportionally rebalances the other columns. |
| SetColumnPercentages | percentages() As Double | (None) | Replaces the column width percentages and normalizes them to one hundred percent. |
| ToHTML | (None) | String | Returns an HTML representation of this content. |
| ToJSON | (None) | JSONItem | Returns a JSON representation of the columns node's persistent state. |
| ToMarkdown | (None) | String | Returns a Markdown representation of this content. |
| TypeName | (None) | String | Returns the display name for this node type. |
## Properties
| Name | Type | Default Value | Description |
| --- | :---: | :---: | --- |
| ActiveColumnWidth | Double | (None) | Gets or sets the percentage width of the active column. |
## Notes
Each column is both editable content and a child-node container.
### JSON Format
Columns use the inherited table-container representation. `rows` is normally one, `columns` is the number of columns, and each entry in the row-major `cells` array is a `TextSnapshot` containing direct text, appearance, and embedded child nodes.
`columnPercentages` is an array of JSON numbers normalized to a total of 100. Each value is constrained to a minimum of 10 percent by the resizing implementation.
### Sizing and Appearance
Drag an internal divider to resize adjacent columns. Widths are stored as normalized percentages with a minimum of ten percent, so they remain proportional when the editor width changes and survive JSON or HTML round trips.
Each column supports its own background color and complete background-image configuration. Child content is measured and clipped within the column.
## Examples
Register a columns prototype before inserting, importing, or restoring columns.
### Two Columns
```xojo
Var columns As New GraffitiProEditor.ColumnsNode(2)
columns.InsertChild(0, 0, New GraffitiProEditor.TextNode("Left column"))
columns.InsertChild(1, 0, New GraffitiProEditor.TextNode("Right column"))
Editor.AddNode(columns)
```