Skip to main content
PKunK.1
Associate III
January 15, 2021
Solved

Process for initializing data in model.cpp

  • January 15, 2021
  • 2 replies
  • 794 views

It is Value A in model.cpp

Attempt to initialize Value A from the model.cpp function.

However, before Value A initializes, setupsrceen() in B_Screenview is executed first, indicating an incorrect value.

I want to know how to initialize Value A in model.cpp before setupscreen() in B_Screenview runs.

#TouchGFX​ 

This topic has been closed for replies.
Best answer by Alexandre RENOUX

Hello PKunk.1,

This a very strange behavior because the Model is called before the View.

If you initialize your variable in Model.cpp as follows this should work correctly.

Model::Model() : modelListener(0)
{
//Initialize here
}

Do you notice this behavior also with the simulator ? If you could provide a UI example where you have this issue, this would be helpful.

/Alexandre

2 replies

Alexandre RENOUX
Alexandre RENOUXBest answer
Visitor II
January 20, 2021

Hello PKunk.1,

This a very strange behavior because the Model is called before the View.

If you initialize your variable in Model.cpp as follows this should work correctly.

Model::Model() : modelListener(0)
{
//Initialize here
}

Do you notice this behavior also with the simulator ? If you could provide a UI example where you have this issue, this would be helpful.

/Alexandre

PKunK.1
PKunK.1Author
Associate III
January 20, 2021

I will test it with the method you told me.

Thank you for reading my writing