Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Dynamically updating a PtMultiText widget: (3 Items)
   
Dynamically updating a PtMultiText widget  
My application has an option to display status messages while it is processing data.

I am attempting to update a PtMultiText widget for each status point in the process.  

It isn't working.  Nothing is displayed in the PtMultiText widget until the process has completed and then it is only 
the last string, not all of them.

Basically, here is the flow and the code that sets the PtMultiText widget.

void ProcessData()
{
    //UPDATE THE USER
    AppendMessage("The Process has started\n");
    //DO WORK
    ...
    //UPDATE THE USER
    AppendMessage("The Process is 33% done\n");
    //MORE WORK
    ...
    //UPDATE THE USER
    AppendMessage("The Process is 66% done\n");

    etc...

    //FINAL UPDATE
    AppendMessage("The Process is done.\n");
}

void AppendMessage(const char* const pszInMsg)
{
    char szFullMsg[8192+1] = {0};
    char* pszCurMsg = 0;

    //GET CURRENT TEXT
    PtGetResource(ABW_MultiTxtMsg, Pt_ARG_TEXT_STRING, &pszCurMsg, 0);
    //MERGE BOTH TEXT VALUES
    sprintf(szFullMsg, "%s %s", pszCurMsg, pszInMsg)
    //SET NEW TEXT
    PtSetResource(ABW_MultiTxtMsg, Pt_ARG_TEXT_STRING, szFullMsg, 0);
}
Re: Dynamically updating a PtMultiText widget  
This is expected -- you consume all the "cycles" ;-) -- photon library never gets a chance to process and render the 
changes.
You can call PtBkgdHandlerProcess() after each multitext update to do the processing. 

Take a look at this chapter: http://www.qnx.com/developers/docs/6.5.0/topic/com.qnx.doc.photon_prog_guide/lengthy.html
It discusses parallel operations.
Re: Dynamically updating a PtMultiText widget  
So, PtSetResource() doesn't actually modify the contents of the widget, it just sets some type of update flag so that it
 is done later, is that correct?

I thought it might be something like that, but I wasn't having any luck finding that in the documentation.

Thank you for pointing me in the right direction, the update process is working correctly now.

I am having another issue, but I will post a separate message about that.

Thanks again!

Kendall

> This is expected -- you consume all the "cycles" ;-) -- photon library never 
> gets a chance to process and render the changes.
> You can call PtBkgdHandlerProcess() after each multitext update to do the 
> processing. 
> 
> Take a look at this chapter: http://www.qnx.com/developers/docs/6.5.0/topic/
> com.qnx.doc.photon_prog_guide/lengthy.html
> It discusses parallel operations.