system.perspective.alterDock Params

Hi,

I have a dock that usually hides (display = onDemand), and want to programmatically change it to visible under certain conditions.

The docs are in conflict with the GUI, where the display options relate to the content options. See below:

  • display: The display state of the dock. Accepted values are:

    • push

    • cover

    • auto

I tried this, without success (also no exception):

		if show:			
			config = {"display":"visible"}
		else:
			config = {"display":"onDemand"}
		system.perspective.alterDock('dockWest', config)

Can someone please point me in the right direction?

8.1.50 for reference.

Regards,

Deon

Hi,

Whilst I do agree this is weird, especially on the different options for display, why don’t you simply use system.perspective.closeDock and system.perspective.openDock ?

system.perspective.toggleDock also exists in case you do not keep track of the state of the dock.

Unless obviously you want to change more parameters, but this is also doable using the functions I mentioned above.

I don’t simply want to open it. I want to ensure it remains open until auto is an option again. Closing and opening is not a suitable option.

The options for display are the push/cover/auto. Unless it's missing from the documentation I don't know if you can change ondemand to visible during runtime.

That was my point.

GUI options for display are visible/onDemand/auto. Docs function options for display are push/cover/auto.

GUI options for content are push/cover/auto. It is entire omitted/conflated with display in the docs.

Is it possible to alter the display visible/onDemand/auto options programmatically?

I solved it like this:

		if not currentValue.value:	
			#Permanently show the dock
			config = {"display":"visible","handle":"hide"}
			system.perspective.alterDock(	dockId = dockId, \
											config = config,\
											pageId = pageId)
			system.perspective.openDock(id = dockId)
		else:
			#Hide and allow manual show
			config = {"display":"onDemand","handle":"show"}
			system.perspective.alterDock(	dockId = dockId, \
											config = config,\
											pageId = pageId)
			system.perspective.closeDock(id = dockId)

Feels clunky, but it works

1 Like

I noticed yesterday myself that the documentation for system.perspective.alterDock is wrong for the display settings. I was making a lock/unlock feature for a dock with similar logic to @deon.korb’s script. See the end of this post:

1 Like