Added more functions. Changed addItem to insertItem
This was SVN commit r2522.
This commit is contained in:
parent
b50d9f529a
commit
4ad8de51bb
@ -59,4 +59,58 @@ function addItem (objectName, pos, value)
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
// Adds an element to the end of the list
|
||||
function pushItem(objectName, value)
|
||||
{
|
||||
var list = getGUIObjectByName(objectName).list;
|
||||
list.push(value);
|
||||
getGUIObjectByName(objectName).list = list;
|
||||
// No need to update selection
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
// Removes the last element
|
||||
function popItem(objectName)
|
||||
{
|
||||
var selected = getGUIObjectByName(objectName).selected;
|
||||
removeItem(objectName, getNumItems(objectName)-1);
|
||||
|
||||
If (selected == getNumItems(objectName)-1)
|
||||
{
|
||||
getGUIObjectByName(objectName).selected = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
// Retrieves the number of elements in the list
|
||||
function getNumItems(objectName)
|
||||
{
|
||||
var list = getGUIObjectByName(objectName).list;
|
||||
return list.length;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
// Retrieves the value of the item at 'pos'
|
||||
function getItemValue(objectName, pos)
|
||||
{
|
||||
var list = getGUIObjectByName(objectName).list;
|
||||
return list[pos];
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
// Retrieves the value of the currently selected item
|
||||
function getCurItemValue(objectName)
|
||||
{
|
||||
if (getGUIObjectByName(objectName).selected == -1)
|
||||
return "";
|
||||
var list = getGUIObjectByName(objectName).list;
|
||||
return list[getGUIObjectByName(objectName).selected];
|
||||
}
|
||||
|
||||
// ====================================================================
|
Loading…
Reference in New Issue
Block a user