|
GUI control that displays a list of text. Text items in the list can be individually selected. More...
Public Member Functions | |
int | addRow (int id=0, string text="", int index=-1) |
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 () |
Clear the list. | |
void | clearSelection () |
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 | getRowTextById (int id) |
Get the text of a row with the specified id. | |
int | getSelectedId () |
Get the ID of the currently selected item. | |
int | getSelectedRow () |
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 | rowCount () |
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 | setSelectedById (int id) |
Finds the specified entry by id, then marks its row as selected. | |
void | setSelectedRow (int rowNum) |
void | sort (int columnId, bool increasing=true) |
Performs a standard (alphabetical) sort on the values in the specified column. | |
void | sortNumerical (int columnID, bool increasing=true) |
Perform a numerical sort on the values in the specified column. | |
Callbacks | |
void | onDeleteKey (string id) |
Called when the delete key has been pressed. | |
void | onSelect (string cellid, string text) |
Called whenever an item in the list is selected. | |
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. |
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. };
int GuiTextListCtrl::addRow | ( | int | id = 0 , |
|
string | text = "" , |
|||
int | index = -1 | |||
) |
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'.
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);
void GuiTextListCtrl::clear | ( | ) |
Clear the list.
// Inform the GuiTextListCtrl control to clear its contents
%thisGuiTextListCtrl.clear();
void GuiTextListCtrl::clearSelection | ( | ) |
Set the selection to nothing.
// Deselect anything that is currently selected
%thisGuiTextListCtrl.clearSelection();
int GuiTextListCtrl::findTextIndex | ( | string | needle | ) |
Find needle in the list, and return the row number it was found in.
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);
int GuiTextListCtrl::getRowId | ( | int | index | ) |
Get the row ID for an index.
index | Index to get the RowID at |
// Define the index %index = "3"; // Request the row ID at the defined index %rowId = %thisGuiTextListCtrl.getRowId(%index);
int GuiTextListCtrl::getRowNumById | ( | int | id | ) |
Get the row number for a specified id.
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);
string GuiTextListCtrl::getRowText | ( | int | index | ) |
Get the text of the row with the specified index.
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);
string GuiTextListCtrl::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);
int GuiTextListCtrl::getSelectedId | ( | ) |
Get the ID of the currently selected item.
// Acquire the ID of the selected item in the list. %id = %thisGuiTextListCtrl.getSelectedId();
int GuiTextListCtrl::getSelectedRow | ( | ) |
Returns the selected row index (not the row ID).
// Acquire the selected row index
%rowIndex = %thisGuiTextListCtrl.getSelectedRow();
bool GuiTextListCtrl::isRowActive | ( | int | rowNum | ) |
Check if the specified row is currently active or not.
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);
void GuiTextListCtrl::onDeleteKey | ( | string | id | ) |
Called when the delete key has been pressed.
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 }
void GuiTextListCtrl::onSelect | ( | string | cellid, | |
string | text | |||
) |
Called whenever an item in the list is selected.
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 }
void GuiTextListCtrl::removeRow | ( | int | index | ) |
Remove a row from the table, based on its index.
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);
void GuiTextListCtrl::removeRowById | ( | int | id | ) |
Remove row with the specified id.
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);
int GuiTextListCtrl::rowCount | ( | ) |
Get the number of rows.
// Get the number of rows in the list %rowCount = %thisGuiTextListCtrl.rowCount();
void GuiTextListCtrl::scrollVisible | ( | int | rowNum | ) |
Scroll so the specified row is visible.
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);
void GuiTextListCtrl::setRowActive | ( | int | rowNum, | |
bool | active | |||
) |
Mark a specified row as active/not.
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);
void GuiTextListCtrl::setRowById | ( | int | id, | |
string | text | |||
) |
Sets the text at the defined id.
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);
void GuiTextListCtrl::setSelectedById | ( | int | id | ) |
Finds the specified entry by id, then marks its row as selected.
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);
void GuiTextListCtrl::setSelectedRow | ( | int | rowNum | ) |
the specified row.
rowNum | Row number to set selected. |
// Define the row number to set selected %rowNum = "4"; %guiTextListCtrl.setSelectedRow(%rowNum);
void GuiTextListCtrl::sort | ( | int | columnId, | |
bool | increasing = true | |||
) |
Performs a standard (alphabetical) sort on the values in the specified column.
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);
void GuiTextListCtrl::sortNumerical | ( | int | columnID, | |
bool | increasing = true | |||
) |
Perform a numerical sort on the values in the specified column.
Detailed description
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);
If true, text exceeding a column's given width will get clipped.
intList GuiTextListCtrl::columns |
A vector of column offsets. The number of values determines the number of columns in the table.
If true, the width of this control will match the width of its parent.