Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Moving widgets
Ref. No. QNX.000009766
Category(ies) Utilities, Development
Issue How to create or move a window relative to the current desktop?x09


Solution Find out the absolute location of the current console, and then the absolute location of your window.
Here is a fragment of code that saves your relative position:
x09
/*get absolute position of window's canvas, and frame dimensions*/
x09PtGetAbsPosition(window, &xpos, &ypos);
x09PtFrameSize(Ph_WM_APP_DEF_RENDER, 0, x09x09x09&leftwid, &tophgt, &rgtwid, &bothgt);
/*calculate absolute position of top left tip of the frame*/
x09windowX = xpos - leftwid;
x09windowY = ypos - tophgt;
x09/*get the current console's absolute coordinates*/
x09PhWindowQueryVisible(0, 0, 0, &console);
x09/*calculate relative position of the window within console*/
x09windowX -= console.ul.x;
x09windowY -= console.ul.y;

Given this, sorting out the "restore" is easy.