MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / findItemText

Method findItemText

Engine/source/gui/controls/guiListBoxCtrl.cpp:500–525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498}
499
500S32 GuiListBoxCtrl::findItemText( StringTableEntry text, bool caseSensitive )
501{
502 // Check Proper Arguments
503 if( !text || !text[0] || text == StringTable->lookup("") )
504 {
505 Con::warnf("GuiListBoxCtrl::findItemText - No Text Specified!");
506 return -1;
507 }
508
509 // Check Items Exist.
510 if( mItems.empty() )
511 return -1;
512
513 // Lookup the index of an item in our list, by the pointer to the item
514 for( S32 i = 0; i < mItems.size(); i++ )
515 {
516 // Case Sensitive Compare?
517 if( caseSensitive && ( String::compare( mItems[i]->itemText, text ) == 0 ) )
518 return i;
519 else if (!caseSensitive && ( dStricmp( mItems[i]->itemText, text ) == 0 ))
520 return i;
521 }
522
523 // Not Found!
524 return -1;
525}
526
527DefineEngineMethod( GuiListBoxCtrl, setCurSel, void, (S32 indexId),,
528 "@brief Sets the currently selected item at the specified index.\n\n"

Callers 1

guiListBoxCtrl.cppFile · 0.80

Calls 6

compareFunction · 0.85
dStricmpFunction · 0.85
warnfFunction · 0.50
lookupMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected