andlabs / ui

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

How to detach a control ? #269

Closed jonatjano closed 6 years ago

jonatjano commented 6 years ago

Hello, I was trying to create a layout since you didn't link it yet but I got this error :

** (uiTest1:28857): CRITICAL **: [libui] /home/jonathan/go/goget/libui/common/control.c:88:uiControlVerifySetParent() You have a bug: You cannot give a uiControl
a parent while it already has one. (control: 0x24ec550; current parent: 0x2474cf0; new parent: 0x2474b90)
SIGTRAP: trace trap
PC=0x4a9f5e m=0 sigcode=128
signal arrived during cgo execution

I understand that it mean I can't append a control when it was already appened before since it can only have one parent but I need to be able to move my component from one parent to another. So here my question :

Is there a way to detach a Control from one parent in order to append it to another parent ?

andlabs commented 6 years ago

Currently the only way to do this is to go to the parent and remove the child there. For windows and groupboxes this is done by setting the child to nil; for tabs, boxes, and grids you just remove the appropriate child index.

jonatjano commented 6 years ago

Thank you, I'll do that. ;-)