I have a window with some containerControls as tabs.
I want to make one tab (containerControl) independent in a new window.
All what I get is that my containerControl has disappeared from both windows, and in the Debugger, the window property of containerControl has assigned the correct one (the new window).
I add the containerControl in the first window with the EmbedWithin option, and later, I use the same method (EmbedWithin) but with the new window reference.
If I first close the containerControl before moving it to the new window, it dissappears completely.
I simply can’t create a new container as those containers has unsaved data there …
well, they are very complex containers with lots of objects, it will be too much work …[quote=45804:@Jym Morton]I’m not sure I understand why you can’t copy the unsaved data in the constructor or open event of window2
Dim cc as new containercontrol
cc.myTextArea.Text = Window1.ccOriginal.myTextArea.Text
cc.EmbedWithin(Self, 0,0)[/quote]
well, they are very complex containers with lots of objects, it will be too much work …
Unfortunately, that is not going to work. An instance of a ContainerControl can only be embedded into a single object.
It sounds like you may want to implement a “copy constructor” on your ContainerControl that copies over all the required values to a new ContainerControl.
[quote=45857:@Paul Lefebvre]Unfortunately, that is not going to work. An instance of a ContainerControl can only be embedded into a single object.
It sounds like you may want to implement a “copy constructor” on your ContainerControl that copies over all the required values to a new ContainerControl.[/quote]
It would be great that existed an unembedded method
Maybe I should file a feature request …
The copy constructor can be very tedious as I have lots of complex objects that simply can’t be referenced, must be copied also …
But in my example, the ContainerControl is embedded into a single object, I want to move from one object to another, I don’t want to stay embedded in two objects at the same time…
You need to create a custom class to store your data, and pass that class instance between the windows. Have each container control read/write the data from your class instance.