cancel
Showing results for 
Search instead for 
Did you mean: 

printing updated strings in a model

prathima
Associate II

hello people..

actually i want to display a string..

i did in this way

char buff[10]="hello";

Unicode::snprintf(buffer,10,"%s",buff);

but am not getting anything.....

in the prinf the buffer is i had the textarea from touchgfx that buffer am taking here...

can you sortout my issue

thank you...

16 REPLIES 16

No problem, glad you got it working!

prathima
Associate II

hello....

actually am trying to pass a string which is defined in model.cpp

up to presenter i can able to pass the whole string but when am passing to the view only i can able to get only first character...why this issue

void Model::tick()

{

tickCounter++;

char buff[20] = "hello hai";

if (modelListener != NULL)

modelListener->notifythetext(buff);

}

modellistener.hpp:

 virtual void notifythetext(char*) {}

presenter.cpp:

void Screen1Presenter::notifythetext(char *buff) {

view.newnotify(*buff);

}

presenter.hpp

 virtual void notifythetext(char*);

view.cpp:

void Screen1View::newnotify(char buff)

  touchgfx::Unicode::UnicodeChar dst[20];

  Unicode::snprintf(textArea1Buffer, 20, "%s", textArea1Buffer, dst);

  textArea1.invalidate();

  textArea1.setWildcard(textArea1Buffer);

  textArea1.resizeToCurrentText();

  textArea1.invalidate();

}

view.hpp:

 virtual void newnotify(char);

can you fix my issue

thank you

prathima
Associate II

 hello ..

I am trying to pass a string from model to view and am printing that into view ....whenever i change the string in model it sholud effect to view also....am can't able to do it while am passing, presenter taking whole string,but view receiving only 1st character..please fix my issue

thank you

helo..how to pass a string from model to view

thank you

Inside of the function void Screen1View::newnotify(char buff) you never copy buff into dst using the Unicode::strncpy() function.

thanks!!!, your reply was very helpful !

I got stuck at this part of program but after reading the code you posted I could fix the issue.

Hi,

 

Works fro me to Thanks.

 

Kind Regards

Rob