Editbox selection should be stopped when the mouse button goes up, even if it happens outside of the box.

--HG--
branch : develop
This commit is contained in:
dfighter1985 2014-09-26 23:29:38 +02:00
parent 3bd552ebb0
commit 938c36027d
2 changed files with 17 additions and 10 deletions

View file

@ -1320,6 +1320,16 @@ namespace NLGUI
} }
} }
// if click, and not frozen, then get the focus
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup && !_Frozen)
{
_SelectingText = false;
if (_SelectCursorPos == _CursorPos)
_CurrSelection = NULL;
return true;
}
if (!isIn(eventDesc.getX(), eventDesc.getY())) if (!isIn(eventDesc.getX(), eventDesc.getY()))
return false; return false;
@ -1329,6 +1339,7 @@ namespace NLGUI
_SelectingText = true; _SelectingText = true;
stopParentBlink(); stopParentBlink();
CWidgetManager::getInstance()->setCaptureKeyboard (this); CWidgetManager::getInstance()->setCaptureKeyboard (this);
CWidgetManager::getInstance()->setCapturePointerLeft (this);
// set the right cursor position // set the right cursor position
uint newCurPos; uint newCurPos;
bool cursorAtPreviousLineEnd; bool cursorAtPreviousLineEnd;
@ -1356,16 +1367,6 @@ namespace NLGUI
return true; return true;
} }
// if click, and not frozen, then get the focus
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup && !_Frozen)
{
_SelectingText = false;
if (_SelectCursorPos == _CursorPos)
_CurrSelection = NULL;
return true;
}
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouserightdown) if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouserightdown)
{ {
CWidgetManager::getInstance()->setCapturePointerRight(this); CWidgetManager::getInstance()->setCapturePointerRight(this);

View file

@ -2539,6 +2539,12 @@ namespace NLGUI
{ {
if ( getCapturePointerLeft() != NULL) if ( getCapturePointerLeft() != NULL)
{ {
if( !handled )
{
CCtrlBase *c = getCapturePointerLeft();
c->handleEvent( evnt );
}
setCapturePointerLeft(NULL); setCapturePointerLeft(NULL);
handled = true; handled = true;
} }