Add ColumnPanel Components In Code

The ColumnPanel is a hairy beast, with a complicated specification for its layout - and it’s not one we’re 100% happy with yet, so we haven’t documented how to make do it from code. This makes it the one piece of Anvil that we don’t (currently) support doing from code, only from the visual designer.

If you’re building a layout from code, we recommend you use the GridPanel component, which is much more comprehensible. (No nested columns - if you want to do nesting, put one GridPanel inside another). Anything you can do with the ColumnPanel, you can do with GridPanels, or nested GridPanels - and the code will be much simpler.

(Trivia: We originally used GridPanels for everything, but they weren’t so great for creating a user-friendly drag’n’drop experience in the designer. We therefore created the ColumnPanel, and the code for laying out components in ColumnPanels is probably the most complicated part of the Anvil designer.)

5 Likes