Notifications
Clear all

[Closed] showToolbar method

Hi!

cui.showToolbar <string>
Displays the Toolbar specified by name.
Returns True on success, False if the toolbar name does not exist.
Available in 3ds Max 2014 and higher.
EXAMPLE:
cui.showToolbar "Brush Presets"
 

Is it possible to do for the method cui.showToolbar false value? Want to make the on\off button for some toolbars

3 Replies
2 Replies
 MZ1
(@mz1)
Joined: 2 years ago

Posts: 0

You can close a dialog by using this founction:

fn CloseDialog Title = 
(
	ChildWindows = UIAccessor.GetChildWindows (windows.GetMaxHwnd())
	PopupDialogs = UIAccessor.GetPopupDialogs()
	for d in (join ChildWindows PopupDialogs) where UIAccessor.GetWindowtext d == Title do UIAccessor.CloseDialog d
)

But actually i couldn’t find an way to know if a dialog is open when is docked. So we cannot create toggle button for docked windows.

(@blyskawka)
Joined: 2 years ago

Posts: 0

one way is to handle it within the macro script, when applied to a toolbar button it will be checked when ever the window is open, or a tick if assigned to a menu

macroScript mymacroscript....
  (
  	local 	isOpen = false
  
  -- roll out definition and code
  
  
  
  	on isChecked do isOpen
  
  	on execute do
  	(
  		
  		if my_Toolbar.open then
  		(	
  			try(cui.UnRegisterDialogBar my_Toolbar)catch()
  			try
  			(
  				destroyDialog my_Toolbar
  				isOpen = false
  			) catch()
  		)	
  		else
  		(
  			createDialog my_Toolbar pos:[0,-100] width:win_width height:win_height lockWidth:true lockHeight:true  style:#()
  			cui.RegisterDialogBar my_Toolbar minSize:200 maxSize:200 style:#(#cui_dock_top,#cui_handles,#cui_floatable)
  			cui.DockDialogBar my_Toolbar #cui_dock_top
  			isOpen = true
  		)	
  	)
  )