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

Method setFirstSelected

Engine/source/gui/controls/guiPopUpCtrl.cpp:813–845  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Added to set the first item as selected.

Source from the content-addressed store, hash-verified

811//------------------------------------------------------------------------------
812// Added to set the first item as selected.
813void GuiPopUpMenuCtrl::setFirstSelected( bool bNotifyScript )
814{
815 if( mEntries.size() > 0 )
816 {
817 mSelIndex = 0;
818 if ( mReplaceText ) // Only change the displayed text if appropriate.
819 {
820 setText( mEntries[0].buf );
821 }
822
823 // Execute the popup console command:
824 if( bNotifyScript )
825 {
826 if ( isMethod( "onSelect" ) )
827 Con::executef( this, "onSelect", Con::getIntArg( mEntries[ mSelIndex ].id ), mEntries[mSelIndex].buf );
828
829 execConsoleCallback();
830 }
831 }
832 else
833 {
834 if ( mReplaceText ) // Only change the displayed text if appropriate.
835 setText("");
836
837 mSelIndex = -1;
838
839 if( bNotifyScript )
840 {
841 Con::executef( this, "onCancel" );
842 execConsoleCallback();
843 }
844 }
845}
846
847//------------------------------------------------------------------------------
848// Added to set no items as selected.

Callers 1

guiPopUpCtrl.cppFile · 0.45

Calls 4

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

Tested by

no test coverage detected