cancel
Showing results for 
Search instead for 
Did you mean: 

Process for initializing data in model.cpp

PKunK.1
Associate III

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​ 

1 ACCEPTED SOLUTION

Accepted Solutions
Alexandre RENOUX
Principal

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

View solution in original post

2 REPLIES 2
Alexandre RENOUX
Principal

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

I will test it with the method you told me.

Thank you for reading my writing