Torque 3D - Script Manual: GuiGameListMenuCtrl Class Reference

TorqueScript

Main   Class List   Namespace List   Online

GuiGameListMenuCtrl Class Reference
[Game Controls]

A base class for cross platform menu controls that are gamepad friendly. More...

Inheritance diagram for GuiGameListMenuCtrl:

List of all members.

Public Member Functions

void activateRow ()
 Activates the current row. The script callback of the current row will be called (if it has one).
void addRow (string label, string callback, int icon=-1, int yPad=0, bool useHighlightIcon=true, bool enabled=true)
 Add a row to the list control.
int getRowCount ()
 Gets the number of rows on the control.
string getRowLabel (int row)
 Gets the label displayed on the specified row.
int getSelectedRow ()
 Gets the index of the currently selected row.
bool isRowEnabled (int row)
 Determines if the specified row is enabled or disabled.
void setRowEnabled (int row, bool enabled)
 Sets a row's enabled status according to the given parameters.
void setRowLabel (int row, string label)
 Sets the label on the given row.
void setSelected (int row)
 Sets the selected row. Only rows that are enabled can be selected.
Callbacks

void onChange ()
 Called when the selected row changes.

Public Attributes

string callbackOnA
 Script callback when the 'A' button is pressed. 'A' inputs are Keyboard: A, Return, Space; Gamepad: A, Start.
string callbackOnB
 Script callback when the 'B' button is pressed. 'B' inputs are Keyboard: B, Esc, Backspace, Delete; Gamepad: B, Back.
string callbackOnX
 Script callback when the 'X' button is pressed. 'X' inputs are Keyboard: X; Gamepad: X.
string callbackOnY
 Script callback when the 'Y' button is pressed. 'Y' inputs are Keyboard: Y; Gamepad: Y.
bool debugRender
 Enable debug rendering.

Detailed Description

A base class for cross platform menu controls that are gamepad friendly.

This class is used to build row-based menu GUIs that can be easily navigated using the keyboard, mouse or gamepad. The desired row can be selected using the mouse, or by navigating using the Up and Down buttons.

Example:
new GuiGameListMenuCtrl()
{
   debugRender = "0";
   callbackOnA = "applyOptions();";
   callbackOnB = "Canvas.setContent(MainMenuGui);";
   callbackOnX = "";
   callbackOnY = "revertOptions();";
   //Properties not specific to this control have been omitted from this example.
};
See also:
GuiGameListMenuProfile

Member Function Documentation

void GuiGameListMenuCtrl::activateRow (  ) 

Activates the current row. The script callback of the current row will be called (if it has one).

void GuiGameListMenuCtrl::addRow ( string  label,
string  callback,
int  icon = -1,
int  yPad = 0,
bool  useHighlightIcon = true,
bool  enabled = true 
)

Add a row to the list control.

Parameters:
label The text to display on the row as a label.
callback Name of a script function to use as a callback when this row is activated.
icon [optional] Index of the icon to use as a marker.
yPad [optional] An extra amount of height padding before the row. Does nothing on the first row.
useHighlightIcon [optional] Does this row use the highlight icon?.
enabled [optional] If this row is initially enabled.
int GuiGameListMenuCtrl::getRowCount (  ) 

Gets the number of rows on the control.

Returns:
(int) The number of rows on the control.
string GuiGameListMenuCtrl::getRowLabel ( int  row  ) 

Gets the label displayed on the specified row.

Parameters:
row Index of the row to get the label of.
Returns:
The label for the row.
int GuiGameListMenuCtrl::getSelectedRow (  ) 

Gets the index of the currently selected row.

Returns:
Index of the selected row.
bool GuiGameListMenuCtrl::isRowEnabled ( int  row  ) 

Determines if the specified row is enabled or disabled.

Parameters:
row The row to set the enabled status of.
Returns:
True if the specified row is enabled. False if the row is not enabled or the given index was not valid.
void GuiGameListMenuCtrl::onChange (  ) 

Called when the selected row changes.

void GuiGameListMenuCtrl::setRowEnabled ( int  row,
bool  enabled 
)

Sets a row's enabled status according to the given parameters.

Parameters:
row The index to check for validity.
enabled Indicate true to enable the row or false to disable it.
void GuiGameListMenuCtrl::setRowLabel ( int  row,
string  label 
)

Sets the label on the given row.

Parameters:
row Index of the row to set the label on.
label Text to set as the label of the row.
void GuiGameListMenuCtrl::setSelected ( int  row  ) 

Sets the selected row. Only rows that are enabled can be selected.

Parameters:
row Index of the row to set as selected.

Member Data Documentation

Script callback when the 'A' button is pressed. 'A' inputs are Keyboard: A, Return, Space; Gamepad: A, Start.

Script callback when the 'B' button is pressed. 'B' inputs are Keyboard: B, Esc, Backspace, Delete; Gamepad: B, Back.

Script callback when the 'X' button is pressed. 'X' inputs are Keyboard: X; Gamepad: X.

Script callback when the 'Y' button is pressed. 'Y' inputs are Keyboard: Y; Gamepad: Y.

Enable debug rendering.



Copyright © GarageGames, LLC. All Rights Reserved.