How to check if it is docked


#1

How can I check to know if a workspaceControl is docked or not?

I tried using the floating arg, but it does not seems to be returning me False irregardless if I put True or False…

cmds.workspaceControl(“mytool”, query=True, floating=False)


#2

So this appears to be working for me. I get False when the control is docked, and True when the control is floating.

win = cmds.workspaceControl('some_workspace_control',retain=False, floating=True)

l = cmds.columnLayout(win)
cmds.button(l)
cmds.button(l)
cmds.button(l)

cmds.showWindow(win)

cmds.workspaceControl(win, q=True, floating=True)

#3

Thanks for the reply and sorry for the late response.

Can I also kindly ask if there is/ are any commands that will allow me to undock/ tear off the panel if it is docked?


#4

If the control is docked you can do, cmds.workspaceControl('some_workspace_control', floating=True, edit=True) and it will undock the control.

You have to use one of the actual dockToWhatever flags to get it docked again though.


#5

Hi R.White, thanks again for the reply.

So, I have a problem, it seems that in this script/ tool that I am writing, the workspaceControl is deleted and the developer whom wrote it is using the setDockableParameters args which comes from MayaQWidgetDockableMixin

self.tool_window.setDockableParameters(dockable=True, x=x_pos, y=y_pos, allowedArea='left', area='left')

And so, this has been docked where using the dockToWhatever that you have mentioned does not undock it…