2004-10-16 00:15:31 +02:00
|
|
|
function GUIObjectHide(objectName)
|
|
|
|
{
|
|
|
|
// Hide our GUI object
|
2004-12-23 23:13:59 +01:00
|
|
|
var GUIObject = getGUIObjectByName(objectName);
|
2004-10-16 00:15:31 +02:00
|
|
|
GUIObject.hidden = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// ====================================================================
|
|
|
|
|
|
|
|
function GUIObjectUnhide(objectName)
|
|
|
|
{
|
|
|
|
// Unhide our GUI object
|
2004-12-23 23:13:59 +01:00
|
|
|
var GUIObject = getGUIObjectByName(objectName);
|
2004-10-16 00:15:31 +02:00
|
|
|
GUIObject.hidden = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// ====================================================================
|
|
|
|
|
|
|
|
function GUIObjectToggle(objectName)
|
|
|
|
{
|
|
|
|
// Get our GUI object
|
2004-12-23 23:13:59 +01:00
|
|
|
var GUIObject = getGUIObjectByName(objectName);
|
2004-10-16 00:15:31 +02:00
|
|
|
|
|
|
|
// Toggle it
|
|
|
|
GUIObject.hidden = !GUIObject.hidden;
|
|
|
|
}
|
|
|
|
|
2004-11-20 18:52:18 +01:00
|
|
|
// ====================================================================
|
|
|
|
|
2005-01-09 14:24:02 +01:00
|
|
|
function GUIObjectRenameandReveal(objectName, objectCaption)
|
|
|
|
{
|
|
|
|
// Get our GUI object
|
|
|
|
var GUIObject = getGUIObjectByName(objectName);
|
|
|
|
|
|
|
|
// Rename it
|
|
|
|
GUIObject.caption = objectCaption;
|
|
|
|
|
|
|
|
// Toggle it
|
|
|
|
GUIObject.hidden = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ====================================================================
|
|
|
|
|
2005-01-10 23:39:53 +01:00
|
|
|
function GUIObjectModifyCaption(objectName, objectModifier, objectPlaces)
|
2005-01-09 16:39:51 +01:00
|
|
|
{
|
|
|
|
// Adds a modifier to a GUI object's caption (eg increase a number by 1).
|
|
|
|
// Obviously don't use this unless you're sure the caption contains a number.
|
2005-01-10 23:39:53 +01:00
|
|
|
// objectPlaces specifies the number of decimal places to use for a floating point number.
|
|
|
|
// If not specified, it defaults to zero (whole number).
|
2005-01-09 16:39:51 +01:00
|
|
|
|
|
|
|
// Get our GUI object
|
|
|
|
var GUIObject = getGUIObjectByName(objectName);
|
|
|
|
|
2005-01-10 23:39:53 +01:00
|
|
|
if (!objectPlaces)
|
|
|
|
objectPlaces = 0;
|
|
|
|
objectPlaces = Math.pow(10, objectPlaces);
|
|
|
|
|
|
|
|
GUIObject.caption = (Math.round(objectPlaces * GUIObject.caption) + Math.round(objectPlaces * objectModifier)) / objectPlaces;
|
2005-01-09 16:39:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ====================================================================
|
|
|
|
|
|
|
|
function GUIObjectSetCaption(objectName, objectCaption)
|
|
|
|
{
|
|
|
|
// Sets an object's caption to the specified value.
|
|
|
|
|
|
|
|
// Get our GUI object
|
|
|
|
var GUIObject = getGUIObjectByName(objectName);
|
|
|
|
|
|
|
|
GUIObject.caption = objectCaption;
|
2005-07-21 01:00:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// ====================================================================
|
|
|
|
|
|
|
|
function SwitchWindow(CloseWindowName, OpenWindowName)
|
|
|
|
{
|
|
|
|
// Helper function that closes a given window (usually the current parent) and opens another one.
|
|
|
|
|
|
|
|
GUIObjectHide (CloseWindowName);
|
|
|
|
GUIObjectUnhide (OpenWindowName);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ====================================================================
|