Problems inserting text in a PtMultiText widget


i’m new to QNX and the PhAB. I went through all the tutorials in the
QNX help and i have some basics in C. Now i am trying to create a GUI to remotly controll a robot. As you might have figured i am experiencing a couple problems :slight_smile:.

I am am trying to insert text (via code) in a PtMultiText widget with
PtTextModifyText. The problem is, i don’t see any text in the textfield.
I based my code on the example given in the QNX help (i assume i declared all variables correctly):

PtSetArg( &args[nargs++], Pt_ARG_DIM, &dim, 0 );
mtext = PtCreateWidget( PtMultiText, NULL, nargs, args );
PtTextModifyText( mtext, NULL, NULL, 0, “Servereply: \n”, 8 );
PtMultiTextModifyText(mtext, NULL, NULL, -1, serverreply.messagetext,
strlen (serverreply.messagetext), &attr,
PtRealizeWidget( window );

I tried to modify the code in more than a few ways, always with the same
result —> no visible text.
Without this:

PtSetResources (ABW_multi_display, 1, args);

i don’t even see a widgt in my application.
Inserting text in the PtMultiText widget with Pt_ARG_TEXT_STRING works fine by the way. But since i need line breaks, i guess i need to use
Hopefully someone could help me out, or maybe even post a simple example on how to insert lines without deleting any lines that were already in the textfield.
I tried to do it with the QNX help, but i don’t seem to get it done…

Thanks in advance.


Afaik PtMultiTextModifyText just works after realization, this means, Check for Pt_CB_REALIZED, then run your PtMultiTextMod…

You can set the Text before by Pt_ARG_TEXT_STRING as you mentioned
You can also set the text this way afterwards, you just need to redraw your Widget

hi micro,

thx for the help.
i modified my code and included Pt_CB_REALIZED now. since i am to much of a n00b i don’t know if this is correct.

PtSetArg (&args[nargs++], Pt_ARG_FLAGS, Pt_TRUE, Pt_CB_REALIZED);
mtext = PtCreateWidget (PtMultiText, NULL, nargs, args);
PtTextModifyText (mtext, NULL, NULL, 0, “Servereply: \n”, 8);
PtMultiTextModifyText (mtext, NULL, NULL, -1, serverreply.messagetext, strlen (serverreply.messagetext), &attr, Pt_MT_FONT);
PtRealizeWidget (window);
PtSetResources (ABW_multi_ausgabe, 1, args);

anyway, the change did not have any effect on the widget. still the same prob, no text…
could you help me out again plz, or maybe even post my code the way you would have modified it.

no actually, you should have checked in your Callback-handling function if Pt_CB_REALIZED has been done, so the Widget Realization has ended. Then u should use PtM…ext. While Creating your Main Window you have to set a CallbackFunction.
In this Function you just write:
if( cb->reason == Pt_CB_REALIZED )


alright, thx again. im gonna have to give that a try next week. got to go now…