andlabs / ui

Platform-native GUI library for Go.
Other
8.33k stars 651 forks source link

Add a new method for Box to clear the children. #352

Open p1gd0g opened 5 years ago

p1gd0g commented 5 years ago

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.

andlabs commented 5 years ago

What are you trying to accomplish with this? Keep in mind that when you delete something from the Box, the child control sticks around.

p1gd0g commented 5 years ago

@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. 😊

treystout commented 5 years ago

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)...