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

Method setSelected

Engine/source/gui/controls/guiPopUpCtrl.cpp:768–809  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

766
767//------------------------------------------------------------------------------
768void GuiPopUpMenuCtrl::setSelected(S32 id, bool bNotifyScript )
769{
770 for( S32 i = 0; i < mEntries.size(); i++ )
771 {
772 if( id == mEntries[i].id )
773 {
774 i = ( mRevNum > i ) ? mRevNum - i : i;
775 mSelIndex = i;
776
777 if( mReplaceText ) // Only change the displayed text if appropriate.
778 setText( mEntries[ i ].buf );
779
780 // Now perform the popup action:
781
782 if( bNotifyScript )
783 {
784 if( isMethod( "onSelect" ) )
785 Con::executef( this, "onSelect", Con::getIntArg( mEntries[ mSelIndex ].id ), mEntries[mSelIndex].buf );
786
787 execConsoleCallback();
788 }
789
790 return;
791 }
792 }
793
794 if( mReplaceText ) // Only change the displayed text if appropriate.
795 {
796 setText("");
797 }
798 mSelIndex = -1;
799
800 if( bNotifyScript && isMethod( "onCancel" ) )
801 Con::executef( this, "onCancel" );
802
803 if( id == -1 )
804 return;
805
806 // Execute the popup console command:
807 if( bNotifyScript )
808 execConsoleCallback();
809}
810
811//------------------------------------------------------------------------------
812// Added to set the first item as selected.

Callers 3

constructEditControlMethod · 0.45
guiPopUpCtrl.cppFile · 0.45
markAsSelectedMethod · 0.45

Calls 4

executefFunction · 0.85
getIntArgFunction · 0.85
setTextFunction · 0.70
sizeMethod · 0.45

Tested by 1

constructEditControlMethod · 0.36