PDA

View Full Version : Refresh a Window


ajk48n
07-13-2003, 06:39 AM
If I have this code:

$userWin = `window -title "User Test Window" User`;
showWindow $userWin;

scrollLayout scrollTestName1;
columnLayout -adjustableColumn 1 -w 400 userColumnLayout2;
button -c "";
button -c "";
button -c "";
button -c "";
button -c "";
button -c "";
button -c "";


The buttons do not show up, because the showWindow is called in the 2nd line. If the showWindow is called in the last line, it looks like it should. Is there any way to have the showWindow in the 2nd line, and then refresh the window so it displays correctly?

galactor
07-13-2003, 12:04 PM
With some window utilities it is possible to "append" new objects to the UI.
But what is the reason for you to put the showWindow on the second line ?

:: Galactor ::

ajk48n
07-13-2003, 07:44 PM
I'm making an interface for building a UI, and I need the window that the user is making to always be visible.

mark_wilkins
07-13-2003, 10:15 PM
Well, I just did some testing, and the only gotcha is that you need to use setParent to set where you're going to create buttons right before you do so.

For example, the top button in this window makes new buttons:


string $myEditableWindow = `window`;
global string $myLayout;
string $myLayout = `columnLayout`;
button -c ("button");
showWindow;


but if you do something else (say open up the Attribute Editor window) the parent user interface item gets set somewhere other than your window and your button doesn't necessarily go where it should. The solution is to use setParent explicitly:


string $myEditableWindow = `window`;
global string $myLayout;
string $myLayout = `columnLayout`;
button -c ("setParent " + $myLayout + ";button");
showWindow;


-- Mark

mark_wilkins
07-13-2003, 10:23 PM
By the way, your code snippet works fine if you put in an appropriate setParent command:


$userWin = `window -title "User Test Window" User`;
showWindow $userWin;
setParent $userWin;
scrollLayout scrollTestName1;
columnLayout -adjustableColumn 1 -w 400 userColumnLayout2;
button -c "";
button -c "";
button -c "";
button -c "";
button -c "";
button -c "";
button -c "";


-- Mark

ajk48n
07-13-2003, 10:40 PM
I tried running that, I still can't see any buttons except for the corner of the first one in the window that opens up.

mark_wilkins
07-13-2003, 10:56 PM
What version of Maya are you running and on what platform? I have the same problem as you on Maya 4.0 on Windows, but Maya 4.5 PLE on the Mac works just fine with that code.

Have you tried using a formLayout and explicitly specifying the spacing and sizes of sublayouts and controls? That might force it to work...

-- Mark

ajk48n
07-14-2003, 12:20 AM
I'm running it on Maya 5.

I tried using formLayout and it worked.

$win = `window`;
showWindow;

$form = `formLayout`;
$scroll = `scrollLayout`;
$col = `columnLayout`;

formLayout -e
-af $scroll "left" 0
-af $scroll "right" 0
-af $scroll "top" 0
-af $scroll "bottom" 0
$form;

setParent $col;

button;
button;
button;
button;
button;
button;
button;

Thanks for the help

CGTalk Moderation
01-15-2006, 03: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.