mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
The Statistics apps crashed when navigating the Data table. -> Check that the textfield is editing before calling textFieldShouldFinishEditing. -> Changed textLength() to draftTextLength(). Change-Id: Id373a7cd50438303f470abc5bcee7a795c33926a
34 lines
1011 B
C++
34 lines
1011 B
C++
#include "text_field.h"
|
|
|
|
namespace Calculation {
|
|
|
|
TextField::TextField(Responder * parentResponder, char * textBuffer, size_t textBufferSize, TextFieldDelegate * delegate) :
|
|
::TextField(parentResponder, textBuffer, textBuffer, textBufferSize, delegate, false)
|
|
{
|
|
setEditing(true);
|
|
}
|
|
|
|
bool TextField::handleEvent(Ion::Events::Event event) {
|
|
if (event == Ion::Events::Back) {
|
|
return false;
|
|
}
|
|
if (event == Ion::Events::Ans) {
|
|
insertTextAtLocation("ans", cursorLocation());
|
|
setCursorLocation(cursorLocation() + strlen("ans"));
|
|
return true;
|
|
}
|
|
if (isEditing() && draftTextLength() == 0 &&
|
|
(event == Ion::Events::Multiplication ||
|
|
event == Ion::Events::Plus ||
|
|
event == Ion::Events::Power ||
|
|
event == Ion::Events::Square ||
|
|
event == Ion::Events::Division ||
|
|
event == Ion::Events::Sto)) {
|
|
insertTextAtLocation("ans", cursorLocation());
|
|
setCursorLocation(cursorLocation() + strlen("ans"));
|
|
}
|
|
return(::TextField::handleEvent(event));
|
|
}
|
|
|
|
}
|