Removing a control that embeds another control

XOJO 2019r3.2 / Windows Desktop

A little, perhaps stupid question, how can you delete a control that includes another control.

Example : I put a Rectangle on the window. In that rectangle I put a Pushbutton.
Moving the rectangle makes the button move with it.
But now I want to remove the rectangle without removing the button.
How can that be done ?


that should work

Me.Parent = Nil
If Rectangle1 <> Nil Then Rectangle1.Close

Sorry, but I was referring to the IDE.
Removing the Rectangle in the design mode.
Selecting the rectangle with the mouse and delete, also deletes all the controls in the rectangle.


Move the controls outside of the rectangle. And yes, it’s annoying.

If you click on and highlight the control in the IDE, and the Rectangle shows a red border, than the Rectangle is the “Parent” of the control.

So, with the control still highlighted, right-click on the control and choose “Unparent”. This allows you to remove the parent relationship without having to move the control. You should now be able to delete the Rectangle without the control also disappearing.

I hope that helps.


@Scott , Great that works exactly as you explained.
Thank you very much.


1 Like