mirror of https://github.com/axmolengine/axmol.git
Merge pull request #14053 from Dimon4eg/Set-focus-for-widgets
Set focus for widgets
This commit is contained in:
commit
0b3a342222
|
@ -536,6 +536,11 @@ bool TextField::onTouchBegan(Touch *touch, Event *unusedEvent)
|
||||||
bool pass = Widget::onTouchBegan(touch, unusedEvent);
|
bool pass = Widget::onTouchBegan(touch, unusedEvent);
|
||||||
if (_hitted)
|
if (_hitted)
|
||||||
{
|
{
|
||||||
|
if (isFocusEnabled())
|
||||||
|
{
|
||||||
|
requestFocus();
|
||||||
|
}
|
||||||
|
|
||||||
_textFieldRenderer->attachWithIME();
|
_textFieldRenderer->attachWithIME();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -888,6 +888,12 @@ void Widget::moveEvent()
|
||||||
void Widget::releaseUpEvent()
|
void Widget::releaseUpEvent()
|
||||||
{
|
{
|
||||||
this->retain();
|
this->retain();
|
||||||
|
|
||||||
|
if (isFocusEnabled())
|
||||||
|
{
|
||||||
|
requestFocus();
|
||||||
|
}
|
||||||
|
|
||||||
if (_touchEventCallback)
|
if (_touchEventCallback)
|
||||||
{
|
{
|
||||||
_touchEventCallback(this, TouchEventType::ENDED);
|
_touchEventCallback(this, TouchEventType::ENDED);
|
||||||
|
@ -1449,7 +1455,7 @@ void Widget::onFocusChange(Widget* widgetLostFocus, Widget* widgetGetFocus)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget* Widget::getCurrentFocusedWidget()const
|
Widget* Widget::getCurrentFocusedWidget()
|
||||||
{
|
{
|
||||||
return _focusedWidget;
|
return _focusedWidget;
|
||||||
}
|
}
|
||||||
|
|
|
@ -775,7 +775,7 @@ public:
|
||||||
* Return a current focused widget in your UI scene.
|
* Return a current focused widget in your UI scene.
|
||||||
* No matter what widget object you call this method on , it will return you the exact one focused widget.
|
* No matter what widget object you call this method on , it will return you the exact one focused widget.
|
||||||
*/
|
*/
|
||||||
Widget* getCurrentFocusedWidget()const;
|
static Widget* getCurrentFocusedWidget();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Call this method with parameter true to enable the Android Dpad focus navigation feature
|
* Call this method with parameter true to enable the Android Dpad focus navigation feature
|
||||||
|
|
Loading…
Reference in New Issue