Problems with PtSetResource()

Hi all,
I’m a newbie in programming with PhAB. Here is the code with which I have the problem.:

for(i=0; i<6; i++)
out = ABW_PtValue; //PtWidget_t *
itoa(i, value, 10);
PtSetResource(out, Pt_ARG_TEXT_STRING, value, 0); //PtLabel

It’s very simple. I just want to show the value of “i” all the time in the PtLabel (0, 1, 2,…,5) for one second.
But the programm counts intern from 0 to 5 and shows after five seconds only 5 in the PtLabel!

Any ideas???

updates are not normally performed until the photon main loop is re-entered. To force an update use PtFlush after PtSetResource. This basic requirement is covered in the docs

Even PtFlush won’t help if you don’t go back to the main loop (I don’t think anyway). Until you return from your callback, the main Photon loop won’t process anything.


The docs state " Ypu’ll need to call this function (PtFlush) explicitly if you’re drawing somewhere ‘outside’ the standard Photon event loop or if you want changes to the widgets to be made immediately."

Sounds pretty clear to me.

In fact I know it works, been doing this stuff for a long time now…

Thanks to all!

PtFlush() fixes my problem!