Torque3D Documentation / _generateds / GuiTextListCtrl

GuiTextListCtrl

consoledoc.h

GUI control that displays a list of text. Text items in the list can be individually selected.

More...

Callbacks

void
onSelect(int cellid, string text)

Called whenever an item in the list is selected.

void
onDeleteKey(int id)

Called when the delete key has been pressed.

Public Attributes

bool

If true, text exceeding a column's given width will get clipped.

intList

A vector of column offsets. The number of values determines the number of columns in the table.

bool

If true, the width of this control will match the width of its parent.

int

Sets how much padding to add to the row heights on top of the font height.

Public Functions

int
addRow(int id, string text, int index)

Adds a new row at end of the list with the defined id and text. If index is used, then the new row is inserted at the row location of 'index'.

void

Clear the list.

void

Set the selection to nothing.

int
findTextIndex(string needle)

Find needle in the list, and return the row number it was found in.

int
getRowId(int index)

Get the row ID for an index.

int
getRowNumById(int id)

Get the row number for a specified id.

string
getRowText(int index)

Get the text of the row with the specified index.

string

Get the text of a row with the specified id.

int

Get the ID of the currently selected item.

int

Returns the selected row index (not the row ID).

bool
isRowActive(int rowNum)

Check if the specified row is currently active or not.

void
removeRow(int index)

Remove a row from the table, based on its index.

void
removeRowById(int id)

Remove row with the specified id.

int

Get the number of rows.

void
scrollVisible(int rowNum)

Scroll so the specified row is visible.

void
setRowActive(int rowNum, bool active)

Mark a specified row as active/not.

void
setRowById(int id, string text)

Sets the text at the defined id.

void

Finds the specified entry by id, then marks its row as selected.

void
setSelectedRow(int rowNum)
void
sort(int columnId, bool increasing)

Performs a standard (alphabetical) sort on the values in the specified column.

void
sortNumerical(int columnID, bool increasing)

Perform a numerical sort on the values in the specified column.

Detailed Description

GUI control that displays a list of text. Text items in the list can be individually selected.

new GuiTextListCtrl(EndGameGuiList)
{
   columns = "0 256";
     fitParentWidth = "1";
   clipColumnText = "0";
    //Properties not specific to this control have been omitted from this example.
};

see:

Reference

Callbacks

onSelect(int cellid, string text)

Called whenever an item in the list is selected.

Parameters:

cellid

The ID of the cell that was selected

text

The text in the selected cel

// A cel in the control was selected, causing the callback to occur
GuiTextListCtrl::onSelect(%this,%callid,%text)
   {
      // Code to run when a cel item is selected
   }

onDeleteKey(int id)

Called when the delete key has been pressed.

Parameters:

id

Id of the selected item in the list

// The delete key was pressed while the GuiTextListCtrl was in focus, causing the callback to occur.
GuiTextListCtrl::onDeleteKey(%this,%id)
   {
      // Code to run when the delete key is pressed
   }

Public Attributes

bool clipColumnText 

If true, text exceeding a column's given width will get clipped.

intList columns 

A vector of column offsets. The number of values determines the number of columns in the table.

bool fitParentWidth 

If true, the width of this control will match the width of its parent.

int rowHeightPadding 

Sets how much padding to add to the row heights on top of the font height.

Public Functions

addRow(int id, string text, int index)

Adds a new row at end of the list with the defined id and text. If index is used, then the new row is inserted at the row location of 'index'.

Parameters:

id

Id of the new row.

text

Text to display at the new row.

index

Index to insert the new row at. If not used, new row will be placed at the end of the list.

// Define the id
%id = "4";

// Define the text to display
%text = "Display Text"

// Define the index (optional)
%index = "2"

// Inform the GuiTextListCtrl control to add the new row with the defined information.
%rowIndex = %thisGuiTextListCtrl.addRow(%id,%text,%index);

return:

Returns the row index of the new row. If 'index' was defined, then this just returns the number of rows in the list.

see:

References

clear()

Clear the list.

// Inform the GuiTextListCtrl control to clear its contents
%thisGuiTextListCtrl.clear();

clearSelection()

Set the selection to nothing.

// Deselect anything that is currently selected
%thisGuiTextListCtrl.clearSelection();

findTextIndex(string needle)

Find needle in the list, and return the row number it was found in.

Parameters:

needle

Text to find in the list.

// Define the text to find in the list
%needle = "Text To Find";

// Request the row number that contains the defined text to find

%rowNumber = %thisGuiTextListCtrl.findTextIndex(%needle);

return:

Row number that the defined text was found in,

getRowId(int index)

Get the row ID for an index.

Parameters:

index

Index to get the RowID at

// Define the index
%index = "3";

// Request the row ID at the defined index
%rowId = %thisGuiTextListCtrl.getRowId(%index);

return:

RowId at the defined index.

getRowNumById(int id)

Get the row number for a specified id.

Parameters:

id

Id to get the row number at

// Define the id
%id = "4";

// Request the row number from the GuiTextListCtrl control at the defined id.
%rowNumber = %thisGuiTextListCtrl.getRowNumById(%id);

getRowText(int index)

Get the text of the row with the specified index.

Parameters:

index

Row index to acquire the text at.

// Define the row index
%index = "5";

// Request the text from the row at the defined index
%rowText = %thisGuiTextListCtrl.getRowText(%index);

return:

Text at the defined row index.

getRowTextById(int id)

Get the text of a row with the specified id.

// Define the id
%id = "4";

// Inform the GuiTextListCtrl control to return the text at the defined row id
%rowText = %thisGuiTextListCtrl.getRowTextById(%id);

return:

Row text at the requested row id.

getSelectedId()

Get the ID of the currently selected item.

// Acquire the ID of the selected item in the list.
%id = %thisGuiTextListCtrl.getSelectedId();

return:

The id of the selected item in the list.

getSelectedRow()

Returns the selected row index (not the row ID).

// Acquire the selected row index
%rowIndex = %thisGuiTextListCtrl.getSelectedRow();

return:

Index of the selected row

isRowActive(int rowNum)

Check if the specified row is currently active or not.

Parameters:

rowNum

Row number to check the active state.

// Define the row number
%rowNum = "5";

// Request the active state of the defined row number from the GuiTextListCtrl control.
%rowActiveState = %thisGuiTextListCtrl.isRowActive(%rowNum);

return:

Active state of the defined row number.

removeRow(int index)

Remove a row from the table, based on its index.

Parameters:

index

Row index to remove from the list.

// Define the row index
%index = "4";

// Inform the GuiTextListCtrl control to remove the row at the defined row index
%thisGuiTextListCtrl.removeRow(%index);

removeRowById(int id)

Remove row with the specified id.

Parameters:

id

Id to remove the row entry at

// Define the id
%id = "4";

// Inform the GuiTextListCtrl control to remove the row at the defined id
%thisGuiTextListCtrl.removeRowById(%id);

rowCount()

Get the number of rows.

// Get the number of rows in the list
%rowCount = %thisGuiTextListCtrl.rowCount();

return:

Number of rows in the list.

scrollVisible(int rowNum)

Scroll so the specified row is visible.

Parameters:

rowNum

Row number to make visible

// Define the row number to make visible
%rowNum = "4";

// Inform the GuiTextListCtrl control to scroll the list so the defined rowNum is visible.
%thisGuiTextListCtrl.scrollVisible(%rowNum);

setRowActive(int rowNum, bool active)

Mark a specified row as active/not.

Parameters:

rowNum

Row number to change the active state.

active

Boolean active state to set the row number.

// Define the row number
%rowNum = "4";

// Define the boolean active state
%active = "true";

// Informthe GuiTextListCtrl control to set the defined active state at the defined row number.
%thisGuiTextListCtrl.setRowActive(%rowNum,%active);

setRowById(int id, string text)

Sets the text at the defined id.

Parameters:

id

Id to change.

text

Text to use at the Id.

// Define the id
%id = "4";

// Define the text
%text = "Text To Display";

// Inform the GuiTextListCtrl control to display the defined text at the defined id
%thisGuiTextListCtrl.setRowById(%id,%text);

setSelectedById(int id)

Finds the specified entry by id, then marks its row as selected.

Parameters:

id

Entry within the text list to make selected.

// Define the id
%id = "5";

// Inform the GuiTextListCtrl control to set the defined id entry as selected
%thisGuiTextListCtrl.setSelectedById(%id);

setSelectedRow(int rowNum)

@briefSelects the specified row.

Parameters:

rowNum

Row number to set selected.

// Define the row number to set selected
%rowNum = "4";

%guiTextListCtrl.setSelectedRow(%rowNum);

sort(int columnId, bool increasing)

Performs a standard (alphabetical) sort on the values in the specified column.

Parameters:

columnId

Column ID to perform the sort on.

increasing

If false, sort will be performed in reverse.

// Define the columnId
%id = "1";

// Define if we are increasing or not
%increasing = "false";

// Inform the GuiTextListCtrl to perform the sort operation
%thisGuiTextListCtrl.sort(%id,%increasing);

sortNumerical(int columnID, bool increasing)

Perform a numerical sort on the values in the specified column.

Detailed description

Parameters:

columnId

Column ID to perform the sort on.

increasing

If false, sort will be performed in reverse.

// Define the columnId
%id = "1";

// Define if we are increasing or not
%increasing = "false";

// Inform the GuiTextListCtrl to perform the sort operation
%thisGuiTextListCtrl.sortNumerical(%id,%increasing);