PtDestroyWidget() behavior

In a fairly large Photon program, I’m having a problem in one
code location where screen damage does not get repaired after
this functional sequence:

ApCreateModule(ABM_ErrorDialog, ABW_base, NULL);
PtSetArg( &args[0], Pt_ARG_TEXT_STRING, “Enter Standby”, 0 ) ;
PtSetResources( ABW_ErrorDialogSeverityLabel, 1, args ) ;
PtSetArg( &args[0], Pt_ARG_TEXT_STRING, “Please Wait …”, 0 ) ;
PtSetResources( ABW_ErrorDialogTextLabel, 1, args ) ;
PtRealizeWidget(ABW_ErrorDialog);
PtFlush() ;

… Here we wait for a hardware event to occur …

PtDestroyWidget(ABW_ErrorDialog);
PtFlush() ;

Following the PtDestroyWidget() call, the ErrorDialog remains
on the screen, which is really weird. This same sequence
works fine in other parts of the code.

Any ideas why?

Ken Schumm <kwschumm@ih8spamqsolv.com> wrote:

In a fairly large Photon program, I’m having a problem in one
code location where screen damage does not get repaired after
this functional sequence:

ApCreateModule(ABM_ErrorDialog, ABW_base, NULL);
PtSetArg( &args[0], Pt_ARG_TEXT_STRING, “Enter Standby”, 0 ) ;
PtSetResources( ABW_ErrorDialogSeverityLabel, 1, args ) ;
PtSetArg( &args[0], Pt_ARG_TEXT_STRING, “Please Wait …”, 0 ) ;
PtSetResources( ABW_ErrorDialogTextLabel, 1, args ) ;
PtRealizeWidget(ABW_ErrorDialog);
PtFlush() ;

… Here we wait for a hardware event to occur …

PtDestroyWidget(ABW_ErrorDialog);
PtFlush() ;

Following the PtDestroyWidget() call, the ErrorDialog remains
on the screen, which is really weird. This same sequence
works fine in other parts of the code.

Any ideas why?

What happens after this is done – do you return to the main loop to
let it process Photon events?

If not, then the problem is that the window behind the destroyed dialog
doesn’t know that it needs to be redrawn. Only damages generated by
widgets within the same window are handled internally and repaired by
PtFlush(); “damages” caused by other windows travel through Photon space
as expose events and must be received from Photon before the affected
areas are redrawn.


Wojtek Lerch QNX Software Systems Ltd.

Previously, Wojtek Lerch wrote in qdn.public.qnx4.photon:

Ken Schumm <> kwschumm@ih8spamqsolv.com> > wrote:
In a fairly large Photon program, I’m having a problem in one
code location where screen damage does not get repaired after
this functional sequence:

ApCreateModule(ABM_ErrorDialog, ABW_base, NULL);
PtSetArg( &args[0], Pt_ARG_TEXT_STRING, “Enter Standby”, 0 ) ;
PtSetResources( ABW_ErrorDialogSeverityLabel, 1, args ) ;
PtSetArg( &args[0], Pt_ARG_TEXT_STRING, “Please Wait …”, 0 ) ;
PtSetResources( ABW_ErrorDialogTextLabel, 1, args ) ;
PtRealizeWidget(ABW_ErrorDialog);
PtFlush() ;

… Here we wait for a hardware event to occur …

PtDestroyWidget(ABW_ErrorDialog);
PtFlush() ;

Following the PtDestroyWidget() call, the ErrorDialog remains
on the screen, which is really weird. This same sequence
works fine in other parts of the code.

Any ideas why?

What happens after this is done – do you return to the main loop to
let it process Photon events?

Light goes on.

This is some code that puts an embedded box into a ‘standby’ mode,
where the graphics controller is put into a low power stasis mode
where video writes are ignored. It looks like graphics are turned
off between the PtDestroyWidget() call and the return to the main
loop. By the time the main loop code executes the video updates
are being ignored.

Is there a way to force the screen to be redrawn outside the
main loop? Otherwise I’ll have to reorder things so graphics
are turned off somewhere else.

Thanks!

Ken Schumm <kwschumm@ih8spamqsolv.com> wrote:

Light goes on.

This is some code that puts an embedded box into a ‘standby’ mode,
where the graphics controller is put into a low power stasis mode
where video writes are ignored. It looks like graphics are turned
off between the PtDestroyWidget() call and the return to the main
loop. By the time the main loop code executes the video updates
are being ignored.

Is there a way to force the screen to be redrawn outside the
main loop? Otherwise I’ll have to reorder things so graphics
are turned off somewhere else.

Call PtBkgdHandlerProcess(). It’s pretty much like PtMainLoop() except
it returns, instead of blocking, when you run out of Photon events.

\

Wojtek Lerch QNX Software Systems Ltd.

Previously, Wojtek Lerch wrote in qdn.public.qnx4.photon:

Ken Schumm <> kwschumm@ih8spamqsolv.com> > wrote:

Is there a way to force the screen to be redrawn outside the
main loop? Otherwise I’ll have to reorder things so graphics
are turned off somewhere else.

Call PtBkgdHandlerProcess(). It’s pretty much like PtMainLoop() except
it returns, instead of blocking, when you run out of Photon events.

Thanks, that did it. I’ve never that one before :slight_smile: