|
|
@@ -257,6 +257,7 @@ bool TextBox::keyEvent(Keyboard::KeyEvent evt, int key)
|
|
|
{
|
|
|
case Keyboard::KEY_RETURN:
|
|
|
// TODO: Support multi-line
|
|
|
+ notifyListeners(Control::Listener::ACTIVATED);
|
|
|
break;
|
|
|
case Keyboard::KEY_ESCAPE:
|
|
|
break;
|
|
|
@@ -394,6 +395,16 @@ unsigned int TextBox::drawText(Form* form, const Rectangle& clip)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+void TextBox::setText(char const *text)
|
|
|
+{
|
|
|
+ Label::setText(text);
|
|
|
+ if (_caretLocation > _text.length())
|
|
|
+ {
|
|
|
+ _caretLocation = _text.length();
|
|
|
+ }
|
|
|
+ notifyListeners(Control::Listener::TEXT_CHANGED);
|
|
|
+}
|
|
|
+
|
|
|
void TextBox::setCaretLocation(int x, int y)
|
|
|
{
|
|
|
Control::State state = getState();
|
|
|
@@ -450,7 +461,13 @@ void TextBox::setCaretLocation(int x, int y)
|
|
|
}
|
|
|
|
|
|
if (index != -1)
|
|
|
+ {
|
|
|
_caretLocation = index;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _caretLocation = _text.length();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void TextBox::getCaretLocation(Vector2* p)
|