[apps][escher] Add methods 'handleEventWithText' in TextField and

TextArea to fix bug in probability (adding a toolbox text from the
calculations controller)
This commit is contained in:
Émilie Feral
2018-02-19 11:18:58 +01:00
committed by EmilieNumworks
parent 7fcf77ce23
commit 576caa039f
24 changed files with 144 additions and 147 deletions

View File

@@ -122,19 +122,11 @@ void VariableBoxController::ContentViewController::insertTextInCaller(const char
char commandBuffer[strlen(text)+1];
Shared::ToolboxHelpers::TextToInsertForCommandText(text, commandBuffer);
if (m_textFieldCaller != nullptr) {
if (!m_textFieldCaller->isEditing()) {
m_textFieldCaller->setEditing(true);
}
int previousCursorLocation = m_textFieldCaller->cursorLocation();
m_textFieldCaller->insertTextAtLocation(commandBuffer, previousCursorLocation);
m_textFieldCaller->setCursorLocation(previousCursorLocation + Shared::ToolboxHelpers::CursorIndexInCommand(commandBuffer));
m_textFieldCaller->handleEventWithText(commandBuffer);
return;
}
if (m_textAreaCaller != nullptr) {
int previousCursorLocation = m_textAreaCaller->cursorLocation();
m_textAreaCaller->insertText(commandBuffer);
int deltaCursorLocation = - m_textAreaCaller->cursorLocation() + previousCursorLocation + Shared::ToolboxHelpers::CursorIndexInCommand(commandBuffer);
m_textAreaCaller->moveCursor(deltaCursorLocation);
m_textAreaCaller->handleEventWithText(commandBuffer);
}
}