cancel
Showing results for 
Search instead for 
Did you mean: 

tutorial3 , Step2:Saving data

Ebun.1
Senior

Hello

Refers to

https://touchgfx.zendesk.com/hc/en-us/articles/360018668232-Step-2-Saving-data

In Screen1Presenter.hpp

model-> saveHour (hour);

How do you get an instance of model?

Also

In Screen1View.hpp

presenter-> saveHour (hour);

How do you get an instance of presenter?

Thank you.

3 REPLIES 3
HP
Senior III

I might be wrong about this but the way I do it is to have a function prototype in my .hpp file and then the function itself in the .cpp file.

If you are writing in the .cpp file and the headers for the model and view are already created you should be able to tab-complete on the names.

You might find more inspiration in my video here: https://www.youtube.com/watch?v=SYdyJBehcYY

Ebun.1
Senior

Hello Mr.HP

The pointer was accessible as it was defined in the base class.

Thank you very much.

Martin KJELDSEN
Chief III

> How do you get an instance of model?

A Presenter already has this instance (in base class, yes). The binding is done in some general bootstrapping code to bind the ONLY instance of model to each active presenter.

And same goes for presenter. A view always has a presenter instance according to the Model-View-Presenter (MVP) software pattern.

/Martin