[Closed] Position Dialogs?
Can you set the position/size of the Max’s native dialog windows, (Material Browser, etc) at runtime, via MaxScript?
some yes, some no.
The UI accessor (Max 2008) doesn’t appear to have a way to get/set the UI dialog’s position (d’oh). If you can get the HWND of the dialog, you should be able to reposition any dialog using .NET; I wouldn’t know how, though
For the material editor and other dialogs that store their position in the 3dsmax.ini file, try adjusting that ini file. I.e.
( please back up 3dsmax.ini before mucking around with it )
setIniSetting ((getDir #maxdata) + "3dsmax.ini") "MtlEditorPosition" "MainWindow" "400 100 367 655"
That should have medit open in the specified position next time it opens, presuming that position wasn’t overwritten since you changed it.
Thanks, that gives me something to chew on … Find The Handle :rolleyes: … I wanted to write a little utility to reset dialogs to default positions at runtime. (The problem of dialogs disappearing when going from 2 to 1 screen setups comes up so often)
the ini is probably your best bet, then. There’s command-line utilities available that will let you easily position a dialog (or even UI control) based on the window title/etc. but they all require that window to actually be open at that time; makes sense, but doesn’t help you much if you only later open the window and go “&$#*($# must be on the other non-existant screen again!”
I suppose the window is open, even if it’s offscreen? In the end, though, I suspect you’re right. The best thing to do is put up with a restart, and edit the ini file.
Correct
well, if you go with the…
setIniSetting ((getDir #maxdata) + “3dsmax.ini”) “MtlEditorPosition” “MainWindow” “400 100 367 655”
…bit, then you shouldn’t have to restart max. However, I don’t think -all- of the dialogs’ positions are stored/retrieved from it… the big ones (material editor, render dialog, VFB, material/map browser, effects/environment, etc.) are, though – so that should go a long way.
Some are stored in the Max file, I don’t know how to get at these. What a shame.
might be missing something obvious here, but couldnt you just reset by closing it, setting the ini and then reopening?
MatEditor.Close()
setIniSetting ((getDir #maxdata) + "3dsmax.ini") "MtlEditorPosition" "MainWindow" "0 0 360 665"
MatEditor.Open()
Aaaaah!:lightbulb Thanks, all. I thought the .ini file was only read on startup! (It’s in the name, I suppose). Well, I learned something today.