transparent Label redraw problem

Hi folks,

I’ve got a problem with transparent Label-Widgets:
After changing the label-image the old image is still visible, here is what i’ve done exactly:
I set the Label-Fillcolor to Transparent.
I load an Image (PxLoadImage()) and set it into the Label (Pt_ARG_LABEL_IMAGE). This is done by an activate CB on a button.
Now I use an OTHER (!!!) button to change allignment (e.g. Pt_ARG_HORIZONTAL_ALIGNMENT to Pt_CENTER) and set a new image to the label.
Now both Images are visible. I have to press the (second) button again or to minmize and maximize the application to make the old image disapear (this is probably the worst english I ever wrote, but I just don’t know how to express this exactly ^^)

You WON’T see this behaviour with such a function:

[code]int
ChangeLabelImage( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
PhImage_t * img1=PxLoadImage("/home/XXX/pics/ep1-simpsons.jpg",NULL);

PtSetResource( ABW_L1, Pt_ARG_HORIZONTAL_ALIGNMENT, Pt_CENTER, 0 );
PtSetResource(ABW_L1,Pt_ARG_LABEL_IMAGE,img1,0);

PtSetResource( ABW_L1, Pt_ARG_HORIZONTAL_ALIGNMENT, Pt_LEFT, 0 );

img1=PxLoadImage("/home/XXX/pics/homer3d.jpg",NULL);
PtSetResource(ABW_L1,Pt_ARG_LABEL_IMAGE,img1,0);

return( Pt_CONTINUE );

}[/code]

but using 2 different functions the bug(???) will apear:

[code]int
ChangeLabelImage( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
PhImage_t * img1=PxLoadImage("/home/XXX/pics/ep1-simpsons.jpg",NULL);

PtSetResource( ABW_L1, Pt_ARG_HORIZONTAL_ALIGNMENT, Pt_CENTER, 0 );
PtSetResource(ABW_L1,Pt_ARG_LABEL_IMAGE,img1,0);

return( Pt_CONTINUE );

}

int
ChangeLabelImageAgain( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
PhImage_t * img1=PxLoadImage("/home/XXX/pics/homer3d.jpg",NULL);

PtSetResource( ABW_L1, Pt_ARG_HORIZONTAL_ALIGNMENT, Pt_LEFT, 0 );

PtSetResource(ABW_L1,Pt_ARG_LABEL_IMAGE,img1,0);

return( Pt_CONTINUE );

}[/code]

Is there any idea how to redraw the Widget without the old image after changing the Allignment?
(As mentioned before, this behavior only appears after changing allignment on a transparent Label widget.)

THANKS a million in advanced

Smee

//edit: I use QNX 6.3

Take a look at PtFlush(), and maybe PtDamageWidget().

Thanks for the quick response,

Calling PtFlush() after changing alignment works, but causes something like flickering because the old image is redrawn with the new alignment before the new image is drawn.

So that’s the way I finally made it:

[code]void
ChangeImage(PtWidget_t * wgt, PhImage_t * img, uchar_t HAlign, uchar_t VAlign)
{
PtSetResource( wgt, Pt_ARG_LABEL_IMAGE, NULL, 0 );
PtFlush();
PtSetResource( wgt, Pt_ARG_HORIZONTAL_ALIGNMENT, HAlign, 0 );
PtSetResource( wgt, Pt_ARG_VERTICAL_ALIGNMENT, VAlign, 0 );

PtSetResource( wgt, Pt_ARG_LABEL_IMAGE, img, 0 );

}[/code]