Window region

Why in Photon 2.0 under QNX6 function PhWindowChange has no effect, but return 0 (everythig allright???) ?
And PhWindowOpen ingnore window info ??

Hi Andrey,

I have spoken to the developer and would it be possible for you to post a sample of the code that you are using for these functions or email them to me.

Thanks
Brenda

Previously, Andrey Belyaev wrote in qdn.public.qnxrtp.photon:

Why in Photon 2.0 under QNX6 function PhWindowChange has no effect, but return 0 (everythig allright???) ?
And PhWindowOpen ingnore window info ??

sample of code : i’m tring to change properties of window region and window (title for example) but have no effect

//=================================================================================================
#include <Pt.h>
#include <iostream.h>
#include <errno.h>

#define EVENT_SIZE sizeof( PhEvent_t ) + 1000

int main( int argc, char *argv[] )
{
PtWidget_t *window;
PtArg_t argwin[2];
PtSetArg(&argwin[0], Pt_ARG_HEIGHT,256, 0);
PtSetArg(&argwin[1], Pt_ARG_WIDTH,256, 0);
if ((window = PtAppInit(NULL, &argc, argv, 4, argwin)) == NULL)
PtExit(1);

PhRegion_t region;
PhRect_t rect;
PhRid_t res;
PhWindowInfo_t wininfo;

rect.ul.x = rect.ul.y = 0;
rect.lr.x = rect.lr.y = 256;

memset(&region, 0, sizeof(region));
memset(&wininfo, 0, sizeof(wininfo));

region.events_sense = Ph_EV_PTR_ALL |
Ph_EV_KEY |
Ph_EV_WM;
region.events_opaque = Ph_EV_PTR_ALL |
Ph_EV_DRAW |
Ph_EV_EXPOSE;
region.flags=Ph_WINDOW_REGION;
region.data_len=sizeof(wininfo);

wininfo.fields = Ph_WM_SET_FLAGS | Ph_WM_SET_STATE |
Ph_WM_SET_RENDER | Ph_WM_SET_FRAME_ATTRIB | Ph_WM_SET_TITLE;

wininfo.managed_f=Ph_WM_APP_DEF_MANAGED; // WM preforms action
wininfo.notify_f=Ph_WM_CLOSE; // App is informed about action
wininfo.state_f=Ph_WM_STATE_ISFOCUS; // current/initial window state
wininfo.render_f=Ph_WM_APP_DEF_RENDER;// how window looks
wininfo.parent_rid=Ph_ROOT_RID; // link to parent region
strcpy(wininfo.title,“My window title”);
strcpy(wininfo.icon_title,“My icon title”);
wininfo.dim_min.w=256;
wininfo.dim_min.h=256;
wininfo.dim_max.w=256;
wininfo.dim_max.h=256;

res = PhWindowChange(Ph_REGION_PARENT |
Ph_REGION_EV_SENSE |
Ph_REGION_EV_OPAQUE |
Ph_REGION_FLAGS |
Ph_REGION_RECT,
Ph_EXPOSE_REGION,&region,&rect,&wininfo);


if (res<0) {
cerr<<“can’t change window region properties”<<endl;
cerr<<"error "<< errno<<endl;
}
cout<<"PhWindowChange return "<<res<<endl;

PgSetRegion(res);

PtRealizeWidget(window);

PhEvent_t *event=(PhEvent_t *)malloc(EVENT_SIZE);
int msg;
for(;;){
msg=PhEventPeek(event,EVENT_SIZE);
if (msg==Ph_EVENT_MSG) {
cout<<"Event “<type<<” - “;
switch(event->type){
case Ph_EV_PTR_MOTION_BUTTON :
cout<<“Ph_EV_PTR_MOTION_BUTTON”;
break;
case Ph_EV_PTR_MOTION_NOBUTTON :
cout<<“Ph_EV_PTR_MOTION_NOBUTTON”;
break;
case Ph_EV_BOUNDARY :
cout<<“Ph_EV_BOUNDARY”;
break;
case Ph_EV_BUT_PRESS :
cout<<“Ph_EV_BUT_PRESS”;
break;
case Ph_EV_BUT_RELEASE :
cout<<“Ph_EV_BUT_RELEASE”;
break;
case Ph_EV_BUT_REPEAT :
cout<<“Ph_EV_BUT_REPEAT”;
break;
case Ph_EV_DRAG :
cout<<“Ph_EV_DRAG”;
break;
case Ph_EV_DRAW :
cout<<“Ph_EV_DRAW”;
break;
case Ph_EV_EXPOSE :
cout<<“Ph_EV_EXPOSE”;
break;
case Ph_EV_INFO :
cout<<“Ph_EV_INFO”;
break;
case Ph_EV_KEY :
cout<<“Ph_EV_KEY”;
break;
case Ph_EV_SERVICE :
cout<<“Ph_EV_SERVICE”;
break;
case Ph_EV_SYSTEM :
cout<<“Ph_EV_SYSTEM”;
break;
case Ph_EV_TIMER :
cout<<“Ph_EV_TIMER”;
break;
case Ph_EV_WM :
cout<<“Ph_EV_WM”;
break;
default:
cout<<“Unknown”;
}
cout<<” subtype "<subtype<<endl;
PtEventHandler(event);
continue;
}
if (msg==Ph_RESIZE_MSG){
cout<<“Need resize …”<<endl;
continue;
}
usleep(5000);
}

free(event);

return 0;
}
//=================================================================================================