@User: After giving this some thought, the problem appears to be caused by the window manager, in that the pop-up dialog window takes the focus, and then the routine that draws the device sends commands which are received by the popup dialog window instead of the layout window. I should be able to correct the problem by forcing focus back to the layout window during drawing.