-
Notifications
You must be signed in to change notification settings - Fork 139
Dynamic layout
This page explains how to change the layout of the terminal dynamically at runtime. This can be done by updating the options at a specific container. The developer creates options that represent the new desired layout using one of the two available methods, i.e. the Binary tree layout or the Grid layout.
Dynamic layout changes are demonstrated in the termdashdemo, run it using the following command:
go run github.com/mum4k/termdash/termdashdemo/termdashdemo.go
In order to update a container, the developer must provide its identifier. By default the created containers have no identifiers assigned and thus cannot be updated. Use the container.ID option to create a container with a custom identifier. This identifier is later used when updating the container.
The container.ID option sets the identifier on a container. This can be later used to update the container's options.
Use the Container.Update method to specify new options for a container.
The Container.Update method applies the specified options to a container with the provided ID. This can be used to perform simple changes like adding a border or layout changes. When changing the layout, the developer can replace the widget with another one or define new splits for the container that effectively establish new layout on the screen.
See a typo, something missing or outright wrong? Feel free to edit the Wiki pages directly, alternatively talk to us.