mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[solver] Prevent adding an expression which is not an equation by
displaying a pop-up (if the input is too long, the automatically added "=0" will fail)
This commit is contained in:
committed by
LeaNumworks
parent
b7ec225088
commit
34198945f2
@@ -117,6 +117,10 @@ bool ListController::textFieldDidReceiveEvent(TextField * textField, Ion::Events
|
||||
if (!textRepresentsAnEquality(textField->text())) {
|
||||
textField->handleEvent(Ion::Events::ShiftRight);
|
||||
textField->handleEventWithText("=0");
|
||||
if (!textRepresentsAnEquality(textField->text())) {
|
||||
app()->displayWarning(I18n::Message::RequireEquation);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Shared::TextFieldDelegate::textFieldDidReceiveEvent(textField, event)) {
|
||||
@@ -132,6 +136,11 @@ bool ListController::expressionLayoutFieldDidReceiveEvent(ExpressionLayoutField
|
||||
if (!textRepresentsAnEquality(buffer)) {
|
||||
expressionLayoutField->handleEvent(Ion::Events::ShiftRight);
|
||||
expressionLayoutField->handleEventWithText("=0");
|
||||
expressionLayoutField->writeTextInBuffer(buffer, TextField::maxBufferSize());
|
||||
if (!textRepresentsAnEquality(buffer)) {
|
||||
app()->displayWarning(I18n::Message::RequireEquation);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Shared::ExpressionLayoutFieldDelegate::expressionLayoutFieldDidReceiveEvent(expressionLayoutField, event)) {
|
||||
|
||||
Reference in New Issue
Block a user