Maximize a gui Window
by Katrina Rose · in Torque Game Engine · 11/04/2004 (4:58 am) · 10 replies
Hi,
How can I make a GUI Window Maximize as soon as it is Canvas.pushDialoged? When the Window comes in it is at "-223 0" because I enable the player to use 2 screen modes 1024 X 768 and 800 X 600. When they are using 800 x 600 I would like to have the GuiWindow automatically Maximize. Any help is greatly apreciated.
Marrion
How can I make a GUI Window Maximize as soon as it is Canvas.pushDialoged? When the Window comes in it is at "-223 0" because I enable the player to use 2 screen modes 1024 X 768 and 800 X 600. When they are using 800 x 600 I would like to have the GuiWindow automatically Maximize. Any help is greatly apreciated.
Marrion
About the author
#2
IETMGuiWindow.position = "0 0";
The window moves to 0,0 and everything is ok. I can't figure out why setting it to "0 0" in the onWake function does not move it. I was hoping for a IETMGuiWindow.Maximize = true; function. I am just trying to make the GuiWindow come in at 0,0 instead of -223,0.
Thanks for your help
Marrion
11/04/2004 (7:52 am)
Thanks for your reply Gonzo. I already have the Extent of the window at 800 X 600, but when the Gui comes up its position is "-223 0". I have tried in the OnWake setting the GuiWindow at "0 0", but it does not move there. If I open the console and type"IETMGuiWindow.position = "0 0";
The window moves to 0,0 and everything is ok. I can't figure out why setting it to "0 0" in the onWake function does not move it. I was hoping for a IETMGuiWindow.Maximize = true; function. I am just trying to make the GuiWindow come in at 0,0 instead of -223,0.
Thanks for your help
Marrion
#3
11/04/2004 (8:22 am)
I think you have to use the resize() function, which takes (xpos, ypos, xextent, yextent). That's kind of annoying that you have to pass the extent, so I made my own Console function which just takes the position.
#4
11/04/2004 (8:34 am)
Thanks for your help. I got it fixed. The Gui itself has to be set. I was trying to just set the window. When I set the Gui itself it was fixed. Thanks.
#5
%gui.position = "0 0";
or whatever setting I want. So your two obvious choices are....
1. You have broken something in the gui positioning code inside the engine.
2. Assuming 1 is NOT correct, and assuming you are using a line similar to the one above in the correct onWake function, then something, somewhere is setting your GUI to that specific position AFTER the onWake function is called and that's why it will not position correctly when you call it, but will move to the correct position when you manually set it afterwards.
11/04/2004 (8:35 am)
Something must be wrong with your code then. I can set my gui's to anywhere I want and have them move to 0 0, 600 600, -200 600, etc... just by having...%gui.position = "0 0";
or whatever setting I want. So your two obvious choices are....
1. You have broken something in the gui positioning code inside the engine.
2. Assuming 1 is NOT correct, and assuming you are using a line similar to the one above in the correct onWake function, then something, somewhere is setting your GUI to that specific position AFTER the onWake function is called and that's why it will not position correctly when you call it, but will move to the correct position when you manually set it afterwards.
#6
11/04/2004 (8:36 am)
Doh!!!! you got in right before I did, lol.
#7
Marrion
11/04/2004 (9:02 am)
Thanks though Gonzo. You are still my favorite clown. I really like seeing your posts because I know when I see one that I am going to learn something. You write the best code for Torque that I have seen on these forums. Keep up the good work. You really should be made an associate.Marrion
#8
11/04/2004 (12:06 pm)
It would probably be better to use getRes() rather than the $Pref, as getRes() actually queries the platform to see what resolution Torque is running at.
#9
11/04/2004 (12:28 pm)
The video device doesn't even render untill Video::setDevice has been told by $pref::Video::resolution what size it is going to be. So since we can safely assume the pref holds the exact dimensions your video is currently running it would be better to access an instant global that is already set than to waste any CPU cycles trying to verify if you are running what you already know you are running..
#10
Considering I have been hesitant to help you in the past due to the owner status misunderstandings, that was a hell of a nice thing to say. Your very welcome, and I'm sorry I wasn't even more help to you like I could have been.
Maybe if we are both lucky, I'll be around to help some more.
11/04/2004 (12:47 pm)
@ MarrionConsidering I have been hesitant to help you in the past due to the owner status misunderstandings, that was a hell of a nice thing to say. Your very welcome, and I'm sorry I wasn't even more help to you like I could have been.
Maybe if we are both lucky, I'll be around to help some more.
Torque Owner Gonzo T. Clown
function YourGui::onWake(%gui)
{
%gui.extent = getWords($pref::Video::resolution, 0, 1);
}