Problem with GUI bitmap border and changing Command property
by Jakob Berglund Rogert · in Torque Game Builder · 04/19/2006 (6:19 am) · 3 replies
Hi! (moved this from torque core to scripting since this forum seem more appropriate)
I've searched my fingers bloody for solutions to these two problems.
The first problem is borders around GUI elements. Most elements come with a border which I never asked for and which I can't seem to disable by any "border = 0", "borderthickness = 0" or "border = false" line.
These are not white borders but dark borders. They appear on every element (textMLCtrl, guibitmap) except for the button element. Since the border also appears around the textMLCtrl, I suppose it isn't a problem with the bitmaps loaded.
Image here: http://picard.hgo.se/~drakborgen/problem.jpg
The second problem I've run into is changing the properties of GUI elements on runtime. What I am trying to build is a system where I can use the same popup over and over, but change the element's properties (like the command property of a button) every time the popup appears. The only way I found so far is to define the GUI elements in a function and then, at the end of the function call pushdialog on the elements. Is there another way to do this or is there at all a way of defining GUI element properties with runtime script (like in a function)?
// Example Code:
function makePopper(%myCard)
{
new GuiMLTextCtrl(popupText) {
canSaveDynamicFields = "0";
Profile = "GuiMLTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "415 225";
Extent = "190 100";
MinExtent = "190 100";
Border = 0;
BorderThickness = 0;
canSave = "1";
Visible = "1";
internalName = "popupText";
hovertime = "1000";
lineSpacing = "2";
allowColorChars = "0";
maxChars = "9000";
text = $cardPopupText;
border = false;
};
new GuiBitmapButtonCtrl(btn00) {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "344 152";
Extent = "47 45";
MinExtent = "8 2";
canSave = "1";
Visible = %myCard.mBtn00.mVisible;
border = false;
Command = %myCard.mbtn00.mCom;
internalName = "btn00";
tooltipprofile = "GuiToolTipProfile";
ToolTip = %myCard.mbtn00.mToolTip;
hovertime = "1000";
groupNum = "-1";
buttonType = "PushButton";
bitmap = %myCard.mbtn00.mImage;
};
canvas.pushDialog(Popper);
}
I've searched my fingers bloody for solutions to these two problems.
The first problem is borders around GUI elements. Most elements come with a border which I never asked for and which I can't seem to disable by any "border = 0", "borderthickness = 0" or "border = false" line.
These are not white borders but dark borders. They appear on every element (textMLCtrl, guibitmap) except for the button element. Since the border also appears around the textMLCtrl, I suppose it isn't a problem with the bitmaps loaded.
Image here: http://picard.hgo.se/~drakborgen/problem.jpg
The second problem I've run into is changing the properties of GUI elements on runtime. What I am trying to build is a system where I can use the same popup over and over, but change the element's properties (like the command property of a button) every time the popup appears. The only way I found so far is to define the GUI elements in a function and then, at the end of the function call pushdialog on the elements. Is there another way to do this or is there at all a way of defining GUI element properties with runtime script (like in a function)?
// Example Code:
function makePopper(%myCard)
{
new GuiMLTextCtrl(popupText) {
canSaveDynamicFields = "0";
Profile = "GuiMLTextProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "415 225";
Extent = "190 100";
MinExtent = "190 100";
Border = 0;
BorderThickness = 0;
canSave = "1";
Visible = "1";
internalName = "popupText";
hovertime = "1000";
lineSpacing = "2";
allowColorChars = "0";
maxChars = "9000";
text = $cardPopupText;
border = false;
};
new GuiBitmapButtonCtrl(btn00) {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "344 152";
Extent = "47 45";
MinExtent = "8 2";
canSave = "1";
Visible = %myCard.mBtn00.mVisible;
border = false;
Command = %myCard.mbtn00.mCom;
internalName = "btn00";
tooltipprofile = "GuiToolTipProfile";
ToolTip = %myCard.mbtn00.mToolTip;
hovertime = "1000";
groupNum = "-1";
buttonType = "PushButton";
bitmap = %myCard.mbtn00.mImage;
};
canvas.pushDialog(Popper);
}
#2
04/20/2006 (4:34 am)
Thank you for the help, but those commands change only some properties. I've yet to find a method to change the command property of a button for example.
#3
One of these problems might just come up in the future and I just found the problem, so I'll take a minute to describe it.
We had ugly 1-pixel borders around nearly all our GUI elements. This was caused by an ugly variable called "border = 1", placed in common/gui/profiles.cs. Changed that to 0 and suddenly all borders disappeared. Yay!
Jakob
04/21/2006 (6:29 am)
Hello again!One of these problems might just come up in the future and I just found the problem, so I'll take a minute to describe it.
We had ugly 1-pixel borders around nearly all our GUI elements. This was caused by an ugly variable called "border = 1", placed in common/gui/profiles.cs. Changed that to 0 and suddenly all borders disappeared. Yay!
Jakob
Torque Owner Tom Bushby
For example, you can use: That would set the button called nextlvlbutton to invisible.
There are similar functions like setVisible, for example .setText("Your Text").
For a full list type in the name of your object, say nextlvlbutton, and then .dump(); into the console.
Hope that helps,
Tom.