2024-12-24 04:21 AM
Hi everyone,
I’ve been trying to implement a mechanism to save two matrices (each containing values of type Unicode::UnicodeChar*) and an errorCount variable using the Model-View-Presenter (MVP) architecture in TouchGFX. The issue arises when transitioning from one screen (Screen1, Screen2, etc.) back to the main screen (Screen), where the matrices are not saved correctly, although errorCount is successfully stored.
Here is the application structure:
The goal is to ensure that, when navigating from any Sudoku screen back to the main screen, the following data is preserved:
I have successfully implemented the mechanism to save and retrieve the errorCount, but the matrices (NumberMatrix and NoteMatrix) are not being saved correctly.
Here is the issue:
Code Implementation:
Model.cpp:
In the Model class, I’ve implemented functions for saving and retrieving the matrices and the errorCount. I use Unicode::strncpy to copy the contents between the matrices. Both matrices are initialized with empty strings ("").
Screen1Presenter.cpp:
Presenter functions call the appropriate methods in the Model to save and retrieve the matrices and errorCount.
Screen1View.cpp:
In the setupScreen and tearDownScreen methods, I call the Presenter functions to save and retrieve the data.
Have you encountered a similar problem in TouchGFX? If you have any suggestions on how to correctly implement saving and restoring matrix data using MVP, I would greatly appreciate your help.
Best regards,
@AS5