sam <seto@vsnl.com> wrote:
i have two separate photon applications. i want to set the base window of
first application as parent of the second application base window.
The short answer is that the PtWindow widget doesn’t support that. It
might be possible if you wrote your own window widget class. But I’m
afraid it would be rather tricky.
It would be much easier and safer to have one application own both
windows and the other application create a PtRegion inside of one of the
windows. You’d have to come up with a way to pass things like key
events and size changes from the window to the PtRegion.
If you don’t mind using an officially unsupported mechanism, you could
try the PtClient and PtServer widgets – they will do most of the above
for you. They’re only documented in QNX 6, but they exist in Photon
1.14 and don’t differ much from what the QNX6 docs say.
In second application i have used PhRegionQuery with basewindow rid, to
get region details of the application. then i am setting the parent member
of the region, to base window Rid of first application. after this i am
calling PhRegionChange for setting the region information.
but this is terminating my application.
In general, PhRegionChange() is not a good way of modifying a window.
It talks directly to Photon, without telling the window manager that
you’ve changed something, which can produce all sorts of confusion. And
in this case, you’d be pulling the window out of its frame and
reparenting it into the other window’s frame, which is not what you
wanted to do anyway.
PhWindowChange() is a better way because it actually asks the window
manager to do the change; but if you do that behind the library’s back,
there’s still a good chance that you’re changing something that the
library may rely on (and in general, there’s no documented way to make
sure that you’re not). And pwm won’t reparent an existing window anyway
– normally when you reparent a widget, the library unrealizes and then
realizes it, which is implemented by destroing the region or window and
then creating a new one.
what is corrent method for setting the parent of the window to another
application window ?
There is no officially supported way of doing that,
do i have to set all the regions of the application as child of the parent?
or is it ok if only the window is as child of the parent and window manager
region of the application is left as it is ?
Reparenting regions won’t help. From the point of view of regions, the
idea of one window being the parent of another doesn’t really exist.
Every window region is the child of its window frame region, and all the
frame regions have the same parent.