PDA

View Full Version : UI window size and keeping it


Jhavna
11-18-2004, 09:49 AM
When I create a window using

window -width 200 -height 123 -title "Window Title" -sizeable true $win_name;

the window is generated ok, but when I resize it and then reopen the window it's the size from when I resized it.

It also opens in different sizes on different machines.

For some reason the fixed width and height doesn't work for me, or is that the expected behaviour?

safakoner
11-18-2004, 10:55 AM
you can add this code to end of your code.

window -e -width 200 -height 123 $win_name;

( -e = -edit )

finally your code must be like this



window -width 200 -height 123 -title "Window Title" -sizeable true $win_name;

some code....
some code....
some code....

showWindow $win_name;

// resize the window
window -e -width 200 -height 123 $win_name;

Jhavna
11-18-2004, 11:00 AM
Thanks, I'll give that a try.

But why is that required? Shouldn't setting the window size on creation take care of that?

Just wondering what the cause is here...

westiemad
11-18-2004, 11:29 AM
it goes a bit funny like that sometimes, there is a command think its like windowPref, where u can tell it to resize the window (by killing any prefs that were set on it after it changed), although this sometimes doesn't work either.

you could try the
int $winW=`window -q -w myWindow`;

if($winW != 200)
window -e -w 200 myWindow;

DanNeufeldt
11-19-2004, 05:30 AM
Thanks, I'll give that a try.

But why is that required? Shouldn't setting the window size on creation take care of that?

Just wondering what the cause is here...
the window tends to try to fit itself to the controls inside it. It works best to use the
window -e -wh $int $int $windowname;
command right before you call ShowWindow;

That way, if you have a complex window, the resize is done before the window is drawn, and it only needs to be drawn once.

galactor
11-19-2004, 08:06 AM
Before i start creating a window, i always place this piece of code before!


if ((`window -exists mayaDirector `)== true)
deleteUI mayaDirector;
if (`windowPref -exists mayaDirector`)
windowPref -remove mayaDirector;


The first statement is always needed to be able to open a window more than one time, and the second deletes the preferences that are saved for that window, so it wil pick up the widt and height values that you asign.
:: Galactor ::

nendo
11-19-2004, 08:11 AM
In fact maya save some preferences for the window, when you closed it. It keep in memory it last size.

So , I prefer to include in my script, just before a line such as:

window -width 200 -height 123 -title "Window Title" -sizeable true $win_name;

the following line :

if ((`windowPref -exists $win_name`) == true )
windowPref -remove $win_name ;

mhovland
11-19-2004, 05:01 PM
This can be fixed by unchecking the option in :

Window|Settings/Preferences|Preferences --> in the Interface Category. Windows Remember Size and Position. Make sure this is unchecked.

This setting overrides the windows height width creation settings, and uses the last size and position of the window.

galactor
11-20-2004, 10:29 AM
This can be fixed by unchecking the option in :
I realy don't see it as a problem that need to be fixed. Imagine you have to make use of the hypershade a lot, and a large window is needed. Everytime you open the hypershade you have to manualy resize that window.
It is ten times easier to include that singel IF statement, and never worry about it anymore.

:: Galactor ::

CGTalk Moderation
01-19-2006, 10:00 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.