------------------------------------------------------------------------------ Added to set the first item as selected.
| 811 | //------------------------------------------------------------------------------ |
| 812 | // Added to set the first item as selected. |
| 813 | void 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. |
no test coverage detected