ui
ui copied to clipboard
Add a new method for Box to clear the children.
It seems there is no way to get the size of a Box, thus it is hard to clear children out of the definition.
Then I add the new method using Delete, please check if it is worth.
Thank you.
What are you trying to accomplish with this? Keep in mind that when you delete something from the Box, the child control sticks around.
@andlabs Thank you for the reply.
Yes, the child sticks so I want to clear all and then reconstruct the Box.
What I am trying to accomplish is a "table", however you know there is a bug on GTK+
https://github.com/andlabs/ui/blob/add47bf25ef41c409d193b2104b368d4de0b3684/examples/table.go#L7
I have tried other Control, grid, form, which works not well. Thus I create the new method to quickly reconstruct a "table" using Box.
Please imform me if you have some advise.
Thank you. 😊
Came here to request the same feature. Loading dynamic lists from HTTP/JSON and using a VerticalBox for each item. Options I see right now when loading new data (AFAIK)...
- Currently: keep an independent store of what items are in the box, and use it's length to just call
box.Delete(n)
over and over - Nice to have: expose the length of children in a Box (solves issue of independent store being out of sync with the GUI)
- Best: The
Clear()
proposed here