can I attach window to rect solid and dettach it to be a float one?

A is a window.
B is mainwindow
I want A embedwithin B and it can’t move.
and when I need,I want to detach A from B to float on top and can move freely.

You can’t embed a window in another. Use a Container Control for that purpose.
Use the floating modal dialog for your other need.

I did something that works functionally the way you say in my PISim program ( The small windows contain ‘devices’ that can be pasted onto ‘control panels’. What’s actually copied over is a canvas containing the contents of the window.

That is pretty easy to do with a containerControl.

To detach it, instanciate it on a new window and copy all relevant data. Then make the one that was on the first window invisible.