PtMessage problems in Phab ApplicationHello,

Hello,
I am trying to use the PtMessage widget in the setup function of the
base window of a Phab application. I cannot get the PtMessage window
to realize. I am trying to execute a subroutine very similar to the
“askresponse()” example given in the PtModalStart() function
description.

The subroutine does the following:

void sub()
{
PtSetArg() /* to set message resources /
PtSetArg() /
to set callbacks for buttons in widget */
PtRealizeWidget(PtCreateWidget(PtMessage, NULL, n, args));

count = PtModalStart();
while(!answer) /* wait for button press */
PtProcessEvent();
PtModalEnd(count);

return;
}

The problem I have is that the PtMessage pop-up never pops up. The
program then just hangs, because there is no pop-up message with a
button to select.

The PtCreateWidget routine returns a widget pointer, the
PtRealizeWidget returns -1, ‘count’ appears to be zero after the
PtModalStart call.

This problem only occurs when I call this routine from the setup
function of the base window in a Phab application. When it is called
from setup functions of dialog boxes, it works fine. Also, the two
subroutines PtMessageBox and PtAskQuestion both pop up without
problems when run from the same base window setup routine.

BTW, I am using this method to display error messages instead of using
PtAskQuestion because I can control the placement of the PtMessage
pop-up. I am using a dual monitor system and the PtAskQuestion pop-up
pops up centered in the split between the two monitors.

Any ideas why the PtMessage box won’t pop up, or how I can control the
placement of the PtAskQuestion pop-up.

I am using QNX 4.25, Photon v1.14.

Thanks for your help,
Greg Laird

Greg Laird <glaird@teleport.com> wrote:

Hello,
I am trying to use the PtMessage widget in the setup function of the
base window of a Phab application. I cannot get the PtMessage window
to realize. I am trying to execute a subroutine very similar to the
“askresponse()” example given in the PtModalStart() function
description.

Call PtSetParentWidget(NULL) before creating the PtMessage. Without
that call, your PtMessage becomes the child of the main window, and
since the parent isn’t realized, the child can’t be realized either.

The subroutine does the following:

void sub()
{
PtSetArg() /* to set message resources /
PtSetArg() /
to set callbacks for buttons in widget */
PtRealizeWidget(PtCreateWidget(PtMessage, NULL, n, args));

count = PtModalStart();
while(!answer) /* wait for button press */
PtProcessEvent();
PtModalEnd(count);

return;
}

The problem I have is that the PtMessage pop-up never pops up. The
program then just hangs, because there is no pop-up message with a
button to select.

The PtCreateWidget routine returns a widget pointer, the
PtRealizeWidget returns -1, ‘count’ appears to be zero after the
PtModalStart call.

This problem only occurs when I call this routine from the setup
function of the base window in a Phab application. When it is called
from setup functions of dialog boxes, it works fine. Also, the two
subroutines PtMessageBox and PtAskQuestion both pop up without
problems when run from the same base window setup routine.

BTW, I am using this method to display error messages instead of using
PtAskQuestion because I can control the placement of the PtMessage
pop-up. I am using a dual monitor system and the PtAskQuestion pop-up
pops up centered in the split between the two monitors.

Any ideas why the PtMessage box won’t pop up, or how I can control the
placement of the PtAskQuestion pop-up.

I am using QNX 4.25, Photon v1.14.

Thanks for your help,
Greg Laird


Wojtek Lerch QNX Software Systems Ltd.

Did you play with PRE_REALIZE / POST_REALIZE in the base window setup CB?
May this happens because there is no base window realized at the time the
setup is called (no parent widget).
No idea about the position of PtMessage.
“Greg Laird” <glaird@teleport.com> schrieb im Newsbeitrag
news:3d337f46.894876694@inn.qnx.com

Hello,
I am trying to use the PtMessage widget in the setup function of the
base window of a Phab application. I cannot get the PtMessage window
to realize. I am trying to execute a subroutine very similar to the
“askresponse()” example given in the PtModalStart() function
description.

The subroutine does the following:

void sub()
{
PtSetArg() /* to set message resources /
PtSetArg() /
to set callbacks for buttons in widget */
PtRealizeWidget(PtCreateWidget(PtMessage, NULL, n, args));

count = PtModalStart();
while(!answer) /* wait for button press */
PtProcessEvent();
PtModalEnd(count);

return;
}

The problem I have is that the PtMessage pop-up never pops up. The
program then just hangs, because there is no pop-up message with a
button to select.

The PtCreateWidget routine returns a widget pointer, the
PtRealizeWidget returns -1, ‘count’ appears to be zero after the
PtModalStart call.

This problem only occurs when I call this routine from the setup
function of the base window in a Phab application. When it is called
from setup functions of dialog boxes, it works fine. Also, the two
subroutines PtMessageBox and PtAskQuestion both pop up without
problems when run from the same base window setup routine.

BTW, I am using this method to display error messages instead of using
PtAskQuestion because I can control the placement of the PtMessage
pop-up. I am using a dual monitor system and the PtAskQuestion pop-up
pops up centered in the split between the two monitors.

Any ideas why the PtMessage box won’t pop up, or how I can control the
placement of the PtAskQuestion pop-up.

I am using QNX 4.25, Photon v1.14.

Thanks for your help,
Greg Laird