My new GUI window, have some problems.
by Henning Martinsen · in Torque Game Engine · 08/10/2005 (3:45 pm) · 7 replies
Hi Kirby Webber.
Ok am here, now what??
You talk about code, which code, code from the new window??
Ok am here, now what??
You talk about code, which code, code from the new window??
Quote:Basically, I'm wondering if you placed the "X" button in the definition of the "Back" button...If I understand what you are asking, then the answer is no. I get my new control, GUI Window Ctrl (GUI Window Profile), after when I have created New GUI. Only one thing I putting on the window, and that is a button; GUI Button Ctrl (GUI Button Profile). In the button, in the box called "Command" I puttind this: Canvas.popDialog(GUIPortalMenu);. The "x", and so on, is follow the window. I cliked away from the window, I think am going to do that for the "x" also. Other window dos not have this problem, only this window. How many time I create a window the same problem follow the window. So I have no idea what is going on, at all!
Quote:Henning... My advice would be to start a new thread in the private forums. In there, you can post your actual gui code for the window in question - It would be much easier to figure out what's wrong if we can see the code. (C;
About the author
#2
Sorry to take so long to reply - busy couple of days. (C;
Okay, first I want to clarify the problem you're having:
You create a gui called GUIPortalMenu.
In it, you have defined a button called "back" that returns the user to the main menu:
Now, if I'm understanding you correctly, this button works as intended - the problem occurs when you try to use the "X" button in the GUIWindowCtrl right? It closes the "Back" button instead of the window?
Hmmm... this is perplexing - please correct me if I've misunderstood you.
It's been a while since I've had to mess with window controls in Torque, and unfortunately I'm not at my home PC right now so I can't test this, but in the GUI editor (F10 in-game), is the 'back' button linked as a child of the windowCtrl?
08/11/2005 (10:22 am)
Hi Henning.Sorry to take so long to reply - busy couple of days. (C;
Okay, first I want to clarify the problem you're having:
You create a gui called GUIPortalMenu.
In it, you have defined a button called "back" that returns the user to the main menu:
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "257 440";
extent = "35 22";
minExtent = "8 2";
visible = "1";
command = "Canvas.popDialog(GUIPortalMenu);";
text = "Back";
groupNum = "-1";
buttonType = "PushButton";
};Now, if I'm understanding you correctly, this button works as intended - the problem occurs when you try to use the "X" button in the GUIWindowCtrl right? It closes the "Back" button instead of the window?
Hmmm... this is perplexing - please correct me if I've misunderstood you.
It's been a while since I've had to mess with window controls in Torque, and unfortunately I'm not at my home PC right now so I can't test this, but in the GUI editor (F10 in-game), is the 'back' button linked as a child of the windowCtrl?
#3
ok, just read the orginal public thread.
I think what your asking is
Why does the window only close when you press the 'Back' button and not the 'X' button on the window itself?
I can see from the code above that you are missing a closeCommand on the window control. This closeCommand will be evaluated when the 'X' button is pressed.
If you add the bold text to your GuiWindowCtrl as shown below, then your window will close when you press the 'X' button.
Also, I see that you do not have the button and MLText as children of the window. You may want to do this as moving the window will not move those components as it currently is.
Humm, trying to follow your english above, it maybe a loss of focus that brings the window foward and hides the back button making it look like it vanished. This could be the result of what I indicated above.
try this
See how the components are now part of the window?
Edit: Eddited for adding the extra code, fixing the positions of the subControls, and stupid spelling mistakes.
08/11/2005 (10:44 am)
Henningok, just read the orginal public thread.
I think what your asking is
Why does the window only close when you press the 'Back' button and not the 'X' button on the window itself?
I can see from the code above that you are missing a closeCommand on the window control. This closeCommand will be evaluated when the 'X' button is pressed.
If you add the bold text to your GuiWindowCtrl as shown below, then your window will close when you press the 'X' button.
new GuiWindowCtrl() {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "235 275";
extent = "230 200";
minExtent = "8 2";
visible = "1";
text = "Portal Link Menu";
maxLength = "255";
resizeWidth = "0";
resizeHeight = "0";
canMove = "1";
canClose = "1";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
[b]closeCommand = "Canvas.popDialog(GUIPortalMenu);"; [/b]
};Also, I see that you do not have the button and MLText as children of the window. You may want to do this as moving the window will not move those components as it currently is.
Humm, trying to follow your english above, it maybe a loss of focus that brings the window foward and hides the back button making it look like it vanished. This could be the result of what I indicated above.
try this
new GuiControl(GUIPortalMenu) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 2";
visible = "1";
new GuiWindowCtrl() {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "235 275";
extent = "230 200";
minExtent = "8 2";
visible = "1";
text = "Portal Link Menu";
maxLength = "255";
resizeWidth = "0";
resizeHeight = "0";
canMove = "1";
canClose = "1";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
closeCommand = "Canvas.popDialog(GUIPortalMenu);";
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "22 165";
extent = "35 22";
minExtent = "8 2";
visible = "1";
command = "Canvas.popDialog(GUIPortalMenu);";
text = "Back";
groupNum = "-1";
buttonType = "PushButton";
};
new GuiMLTextCtrl() {
profile = "GuiMLTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "9 27";
extent = "64 14";
minExtent = "8 2";
visible = "1";
lineSpacing = "2";
allowColorChars = "1";
maxChars = "-1";
text = "Link name";
};
new GuiMLTextCtrl() {
profile = "GuiMLTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "78 27";
extent = "64 14";
minExtent = "8 2";
visible = "1";
lineSpacing = "2";
allowColorChars = "1";
maxChars = "-1";
text = "Type Link";
};
new GuiMLTextCtrl() {
profile = "GuiMLTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "155 27";
extent = "64 14";
minExtent = "8 2";
visible = "1";
lineSpacing = "2";
allowColorChars = "1";
maxChars = "-1";
text = "Comments";
};
};
};See how the components are now part of the window?
Edit: Eddited for adding the extra code, fixing the positions of the subControls, and stupid spelling mistakes.
#4
Excellent Simon. (C:
08/11/2005 (10:57 am)
I thought they needed to be tucked inside the GUIWindowCtrl brackets.Excellent Simon. (C:
#5
Ok how do I prevent this to happen again??
Even it's yellow on the GUIPortalMenu??
Maybe the window is to small to get focus??
Any idea how to prevent this to happen again????
Thanks again guys, am grateful for all helps.
08/11/2005 (12:16 pm)
Thanks for all help guys, and you Simon Duggan your code was very good, thanks.Ok how do I prevent this to happen again??
Even it's yellow on the GUIPortalMenu??
Maybe the window is to small to get focus??
Any idea how to prevent this to happen again????
Thanks again guys, am grateful for all helps.
Quote:Sorry to take so long to reply - busy couple of days.That's ok, am not in hurry. :)
#6
I think your selecting GUIPortalMenu when adding the components? That makes sence with what I saw in your code paste. You need to select the window control, (EG: Make GuiWindowCtrl yellow) before adding your subControls to it.
Practice making GUI's until you think you won't have it happen again. It's just a learning experiance.
08/11/2005 (2:46 pm)
Henning,Quote:
Even it's yellow on the GUIPortalMenu??
I think your selecting GUIPortalMenu when adding the components? That makes sence with what I saw in your code paste. You need to select the window control, (EG: Make GuiWindowCtrl yellow) before adding your subControls to it.
Quote:
Ok how do I prevent this to happen again??
Practice making GUI's until you think you won't have it happen again. It's just a learning experiance.
#7
08/11/2005 (3:08 pm)
Thanks. :)
Torque Owner Henning Martinsen
/--- OBJECT WRITE BEGIN ---
new GuiControl(GUIPortalMenu) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 2";
visible = "1";
new GuiWindowCtrl() {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "235 275";
extent = "230 200";
minExtent = "8 2";
visible = "1";
text = "Portal Link Menu";
maxLength = "255";
resizeWidth = "0";
resizeHeight = "0";
canMove = "1";
canClose = "1";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
};
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "257 440";
extent = "35 22";
minExtent = "8 2";
visible = "1";
command = "Canvas.popDialog(GUIPortalMenu);";
text = "Back";
groupNum = "-1";
buttonType = "PushButton";
};
new GuiMLTextCtrl() {
profile = "GuiMLTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "244 302";
extent = "64 14";
minExtent = "8 2";
visible = "1";
lineSpacing = "2";
allowColorChars = "1";
maxChars = "-1";
text = "Link name";
};
new GuiMLTextCtrl() {
profile = "GuiMLTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "313 302";
extent = "64 14";
minExtent = "8 2";
visible = "1";
lineSpacing = "2";
allowColorChars = "1";
maxChars = "-1";
text = "Type Link";
};
new GuiMLTextCtrl() {
profile = "GuiMLTextProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "390 302";
extent = "64 14";
minExtent = "8 2";
visible = "1";
lineSpacing = "2";
allowColorChars = "1";
maxChars = "-1";
text = "Comments";
};
};
//--- OBJECT WRITE END ---