Game Development Community

guiMLTextEidtCtrl not consuming characters (w/fix)

by Nathan Bowhay - ESAL · in Torque 3D Professional · 08/05/2009 (3:36 pm) · 1 replies

There is a bug that happens if you click on a guiTextEditCtrl, type something in it and then try and click on a guiMLTextEditCtrl and type something nothing with be typed. I figure out how to fix it (sorta luck of the draw) I just moved some code from guiTextEditCtrl.

It seems like they fixed issues/have code in guiTextEditCtrl control that works and needs to be moved to guiMLTextEditCtrl. To fix it I just moved over the setFirstResponder and onLoseFirstResponder code from gioTextEditCtrl:
void GuiMLTextEditCtrl::setFirstResponder()
{
   Parent::setFirstResponder();

   GuiCanvas *root = getRoot();
   if (root != NULL)
   {
		root->enableKeyboardTranslation();
  

	   // If the native OS accelerator keys are not disabled
		// then some key events like Delete, ctrl+V, etc may
		// not make it down to us.
		root->setNativeAcceleratorsEnabled( false );
   }
}

void GuiMLTextEditCtrl::onLoseFirstResponder()
{
   GuiCanvas *root = getRoot();
   root->setNativeAcceleratorsEnabled( true );
   root->disableKeyboardTranslation();

   // Redraw the control:
   setUpdate();
}

As a side note I am also moving over the blinking cursor code, but it may have caused bugs so i won't post that on here yet I will post it in another thread and probably link in here. Also this issue has been around for a while: www.garagegames.com/community/forums/viewthread/69830

This also may be a beta 4 bug as well but I haven't had a chance to port and test it.

#1
08/06/2009 (2:16 pm)
Ok I finished the other change to the ctrl to get a blinking cursor, I just forgot to call Parent::onPreRender();.

Here is the resource:
www.garagegames.com/community/resources/view/18043