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

Method closePopUp

Engine/source/gui/controls/guiPopUpCtrlEx.cpp:1298–1367  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1296
1297//------------------------------------------------------------------------------
1298void GuiPopUpMenuCtrlEx::closePopUp()
1299{
1300 if ( !mInAction )
1301 return;
1302
1303 // Get the selection from the text list:
1304 mSelIndex = mTl->getSelectedCell().y;
1305 mSelIndex = ( mRevNum >= mSelIndex && mSelIndex != -1 ) ? mRevNum - mSelIndex : mSelIndex;
1306 if ( mSelIndex != -1 )
1307 {
1308 if ( mReplaceText )
1309 setText( mEntries[mSelIndex].buf );
1310 setIntVariable( mEntries[mSelIndex].id );
1311 }
1312
1313 // Release the mouse:
1314 mInAction = false;
1315 mTl->mouseUnlock();
1316
1317 // Commented out below and moved to the end of the function. See the
1318 // note below for the reason why.
1319 /*
1320 // Pop the background:
1321 getRoot()->popDialogControl(mBackground);
1322
1323 // Kill the popup:
1324 mBackground->removeObject( mSc );
1325 mTl->deleteObject();
1326 mSc->deleteObject();
1327 mBackground->deleteObject();
1328
1329 // Set this as the first responder:
1330 setFocus();
1331 */
1332
1333 // Now perform the popup action:
1334 if ( mSelIndex != -1 )
1335 {
1336 char idval[24];
1337 dSprintf( idval, sizeof(idval), "%d", mEntries[mSelIndex].id );
1338 if ( isMethod( "onSelect" ) )
1339 Con::executef( this, "onSelect", idval, mEntries[mSelIndex].buf );
1340 }
1341 else if ( isMethod( "onCancel" ) )
1342 Con::executef( this, "onCancel" );
1343
1344 // Execute the popup console command:
1345 execConsoleCallback();
1346 //if ( mConsoleCommand[0] )
1347 // Con::evaluate( mConsoleCommand, false );
1348
1349 // Reordered this pop dialog to be after the script select callback. When the
1350 // background was popped it was causing all sorts of focus issues when
1351 // suddenly the first text edit control took the focus before it came back
1352 // to this popup.
1353
1354 // Pop the background:
1355 GuiCanvas *root = getRoot();

Callers 4

onMouseDownMethod · 0.45
onKeyDownMethod · 0.45
onMouseUpMethod · 0.45
guiPopUpCtrlEx.cppFile · 0.45

Calls 9

setIntVariableFunction · 0.85
dSprintfFunction · 0.85
executefFunction · 0.85
getSelectedCellMethod · 0.80
popDialogControlMethod · 0.80
setTextFunction · 0.70
mouseUnlockMethod · 0.45
removeObjectMethod · 0.45
deleteObjectMethod · 0.45

Tested by

no test coverage detected