[PB] Centering PtAlert on a Window

Hello,

I would like to center a PtAlert on the main Window of my
application, so from the documentation, I understand that
the first argument of PtAlert is the parent widget (the
main window) and that if the second input (the position) is
NULL then, the PtAlert should be centered.

The problem is that the PtAlert is always getting centered
on the screen on not on the window parent :frowning:

Thanks for any help/tips.

Regards.

jean-louis

I believe it’s a bug in Photon. I use the following code - it does not
center the dialog in the parent window (can’t do this because don’t know the
size of the alert dialog), but at least it centers the upper left corner in
the parent window.
You’ll need to replace the getXPos() etc with the appropriate calls to
PtGetResource
Markus


PhRect_t currentConsoleExtent;
PhPoint_t center;

PhWindowQueryVisible(0, 0, 1, &currentConsoleExtent);

center.x = getXPos() - currentConsoleExtent.ul.x + getWidth() / 2;
center.y = getYPos() - currentConsoleExtent.ul.y + getHeight() / 2;

PtAlert(parentWidget, &center, …);





“Jean-Louis Villecroze” <jlv@kirilla.com> wrote in message
news:9ggl0o$k4u$1@inn.qnx.com

Hello,

I would like to center a PtAlert on the main Window of my
application, so from the documentation, I understand that
the first argument of PtAlert is the parent widget (the
main window) and that if the second input (the position) is
NULL then, the PtAlert should be centered.

The problem is that the PtAlert is always getting centered
on the screen on not on the window parent > :frowning:

Thanks for any help/tips.

Regards.

jean-louis

Hi Markus,

Thanks for the tips :slight_smile:

Regards,

jean-louis