Troubleshooting PutRect Drawing Over Background Images

Karen Mitchell2 min read
HMI ProgrammingOther ManufacturerTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

A PutRect block can retain multiple rectangles on an empty screen yet appear to erase earlier rectangles when the same drawing runs over a full-screen background image. The evidence shows that the enable-signal duration is not the root cause. Dynamic numeric input/output objects above the image trigger repeated screen rendering, which restores the background and removes graphics drawn outside that refresh sequence.

Observed PutRect Behavior

Screen configuration Observed result
Empty screen without the background image Successive rectangles remain visible.
Full-screen background image with dynamic numeric input/output objects Each newly drawn rectangle appears while earlier rectangles disappear.
Navigate away from the drawing screen The rectangle is no longer visible.

The C program calculates an unknown quantity of rectangles and their coordinates, then passes the coordinates and an enable signal to one PutRect block. Holding en active while changing coordinates does not preserve the earlier rectangles on the affected screen.

Root Cause: Cyclic Screen Redrawing

The background image is not the only relevant object. Numeric input/output objects placed over it may change at any time, so the controller redraws the image and then redraws those numeric objects during each display cycle. A rectangle written independently by PutRect is removed when the background is restored.

This explains why changing the image's dynamic visibility did not solve the problem: the failure follows the screen's redraw activity, not merely whether the image is currently visible.

Confirm the Redraw Conflict

  1. Run the same PutRect coordinate and enable sequence on a screen without the background image. Confirm that all rectangles remain visible.
  2. Run that sequence on the screen containing the full-screen image and dynamic numeric input/output objects. Confirm that earlier rectangles disappear as the screen content refreshes.
  3. Compare the results. If the empty screen preserves the rectangles and the populated screen does not, treat cyclic screen rendering as the cause rather than adjusting the duration of en.

Correct the Screen Design

Place the accumulated PutRect output on a screen that is not continuously restoring the background beneath it, or remove the dynamic numeric input/output objects that force that redraw from the drawing screen. The verified configuration is the clean screen without the background-image redraw conflict.

If the background and changing numeric fields must remain, the supplied evidence does not identify a supported persistent overlay mechanism. In that case, redesign the rendering sequence so every required rectangle is redrawn after each background refresh, and verify that behavior in the target project before deployment.

FAQ

Why does PutRect erase the previous rectangle?

Dynamic numeric input/output objects cause the controller to redraw the background image and then the numbers. Restoring the image removes rectangles drawn independently over it.

Does the PutRect en signal need a longer pulse?

No evidence links the failure to pulse duration. The same rectangle sequence remains visible on an empty screen, which isolates the problem to screen redraw activity.

How do I verify that the background image causes the problem?

Execute the same coordinates and en sequence on an empty screen and on the screen containing the image and dynamic numeric objects. If only the populated screen loses earlier rectangles, the cyclic redraw is erasing them.

Back to blog