Game Development Community

Bug with guiTextEditSliderCtrl not setting $thisControl

by Andy Rollins · in Torque Game Engine Advanced · 09/13/2009 (8:03 am) · 1 replies

The guiTextEditSliderCtrl doesn't set the $thisControl value before executing the console command, looking at the onMouseUp() function

mMulInc = 0.0f;
   mouseUnlock();
  //if we released the mouse within this control, then the parent will call
  //the mConsoleCommand other wise we have to call it.
   Parent::onMouseUp(event);
  //if we didn't release the mouse within this control, then perform the action
  // if (!cursorInControl())
      Con::setVariable("$ThisControl", avar("%d", getId()));
      Con::evaluate(mConsoleCommand, false);

   if (mAltConsoleCommand && mAltConsoleCommand != "" && mAltConsoleCommand[0])
      Con::evaluate(mAltConsoleCommand, false);

   mTextAreaHit = None;

It's a bit bawked as the parent class doesn't call any of the mConsoleCommand as suggested by the comments and commented out // if(!cursorInControl()) leads me to believe that Melv Mays quick fix back in 2002 was all that got fixed in the engine.

I've noticed this in TGEA 1.8.1 but I'm guessing it's a bug in TGE, TGEA and Torque 3D too. The fix for me was just to set the $ThisControl value just prior to executing the console commands, for example:

Con::setVariable("$ThisControl", avar("%d", getId()));
      Con::evaluate(mConsoleCommand, false);


#1
09/19/2009 (11:06 pm)
Logged. It'll probably be fixed by changing the direct calls to Con::evaluate with GuiControl::exec(Alt)ConsoleCallback.