PDA

View Full Version : Position Dialogs?


drdubosc
04-10-2008, 11:46 AM
Can you set the position/size of the Max's native dialog windows, (Material Browser, etc) at runtime, via MaxScript?

ZeBoxx2
04-10-2008, 12:10 PM
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.

drdubosc
04-10-2008, 12:47 PM
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)

ZeBoxx2
04-10-2008, 01:01 PM
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!" :)

drdubosc
04-10-2008, 02:57 PM
the ini is probably your best bet, then.... There's command-line utilities ... but they all require that window to actually be open at that time....

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.

ZeBoxx2
04-10-2008, 03:42 PM
I suppose the window is open, even if it's offscreen?
Correct

The best thing to do is put up with a restart, and edit the ini file.
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.

PEN
04-10-2008, 04:07 PM
Some are stored in the Max file, I don't know how to get at these. What a shame.

LoneRobot
04-10-2008, 04:26 PM
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()

drdubosc
04-10-2008, 08:24 PM
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.

CGTalk Moderation
04-10-2008, 08:24 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.