bubbleboxer icon indicating copy to clipboard operation
bubbleboxer copied to clipboard

Resizing Examples

Open greenm01 opened this issue 3 years ago • 1 comments

Hello,

First, thanks for creating this cool little library for bubbletea!

I'd like to create a system of menu "tabs," each with it's own Boxer as part of my CLUI. I'm trying to understand how to specify the width and hight of child nodes at creation, and also during runtime.

Would you please provide some additional examples on how to accomplish sizing and resizing boxes?

Thanks!

greenm01 avatar Aug 17 '22 17:08 greenm01

Hi, thanks for the interest and sorry for the late answer.

each with it's own Boxer

Beware that Boxer is build to have one instance for the hole application. So i think you mean own Box?

specify [...] child nodes at creation

you dont have to, since it is more useful to wait for the size information and set then the correct size, see here.

To specifiy the size during runtime you have to set an according SizeFunc in the parent of the nodes you want to change the size of. This SizeFunc shall partition the space for the children by returning a int-slice of the same lenght as the children of this node, whereby each int corresponds to the amout of spaces of the child at this index, see here.

Hope this helps! Cheers!

treilik avatar Aug 30 '22 06:08 treilik