Notifications
Clear all

[Closed] Help on a very basic MaxScript command

I’m just learning how to do stuff with maxScript,
so far I have been able to do a very basic rollout
here’s the code:

rollout myRollout “Polygons” width:184 height:544
(

  button btn1 "Box" pos:[8,16] width:160 height:38


  on btn1 pressed do
  (
  
              box ()
  
             
  
  )

)
myFloater = newrolloutfloater “Tools” 200 600

addrollout myRollout myFloater

it’s working fine, but I want to be able to dock this window or rollout to the max UI.
but I can’t find the missing command.

I hope some of you guys know the solution for this.

Thanks anyway for taken the time to read this post.

Hooch.

5 Replies

Hi Hooch,

You can use macroscripts in order to be able to connect a menu or a toolbar with your script.

macroScript Tools category:"hooch"
(
	rollout myRollout "Polygons" width:184 height:544
	(
		button btn1 "Box" pos:[8,16] width:160 height:38
		
		on btn1 pressed do
		(
		box ()
		)	
	)
	
	myFloater = newrolloutfloater "Tools" 200 600
	addrollout myRollout myFloater
)

Save this code as a “.mcr” file and run it.

After, in order to assign this script to a menu or toolbar you need to go to Customize User Interface dialog. Choose “Toolbars” or “Menus” tab page, select “Hooch” in “Category” list, drag the “Tools” label in “Action” window and drop it to a toolbar in the UI or a menu in the tree view.

To know more about using macroscripts please refer to “Defining MacroScripts” section in MAXScript Reference.

ypuech: thanks for your reply, but that’s not what I meant,

What I need is to be able to dock this menu as it is in the right side of the max UI

(
global myRollout
try(cui.UnRegisterDialogBar myRollout)catch()
try(destroyDialog myRollout)catch()
rollout myRollout "Polygons" width:184 height:544
(
button btn1 "Box" pos:[8,16] width:160 height:38
on btn1 pressed do
(
box ()
)
)
createDialog myRollout 
cui.RegisterDialogBar myRollout style:#(#cui_dock_right, #cui_dock_left, #cui_floatable)
cui.DockDialogBar myRollout #cui_dock_right
)

It is a good idea to give the dialog a longer, unique name.
Also, only dialogs can be docked, not floaters. If you need multiple rollouts in your UI, use sub-rollouts…

thanks a lot Bobo!
Some how I knew you where gonna answer this one.

Thanks Bobo for the answer. I did not know that it was possible to do that.