2020-04-01 12:31 AM
2020-04-08 11:11 AM
I thought you were using pseudo code in your last post. You can't pass a struct like that. You need to use the actual type which is a struct. e.g. in c++.
struct mystruct
{
int a;
int b;
};
....
virtual void setStructValue1(mystruct s){}
2020-04-09 12:11 AM
Thank you,
In model.cpp
Model::Model() : modelListener(0), hour(0), minute(0),XY(5),AB(0),led_state(false)
{
s.a = 1;
s.b = 2;
}
void Model::tick()
{
modelListener->setStructValue1(s); //que: HOW TO CALL THIS FUNCTION?
}
How to write modelListener->setStructValue1(s); ? This is wrong
2020-04-09 12:33 AM
../TouchGFX/gui/src/model/Model.cpp:55:42: error: expected primary-expression before 's'
modelListener->setStructValue1(MyStruct s);
#error
2020-04-09 02:10 AM
You can't pass values like that. You're declearing a variable s of type MyStruct as an argument and that's illegal c++ (and C). Can I suggest you do an introductory course on C++? But for what it's worth...
//model.hpp: Declare s to be of type MyStruct to be used in the model
MyStruct s;
//model.cpp
s.a = 1;
s.b = 2;
modelListener->setStructValue1(s);
/Martin
2020-04-09 02:45 AM
modelListener->setStructValue1(s);
I have written this, still got error,
Do you have any TouchGFX project in that structure have saved in model and used in view.cpp? if so plz share with me.
Thank you.
I will surely work on your suggestion.
2020-04-09 02:53 AM
We have tons - Check any of the demos from the designer and look through the models and modellisteners.
2020-04-09 04:35 AM
Ya I have seen examples
I am able to pass integer values in between listener and view but with structure dayatype I haven't came across , which is my concern
I will check if I can get some
Thank you