Symptom

In an MDI application, when a sheet containing a WebBrowser control (WebView2) is open behind another sheet, calling window.SetRedraw(false) on the foreground sheet causes the WebBrowser control from the background sheet to bleed through and render on top of the focused foreground sheet.


Environment

PowerBuilder 2022 R2 and later versions


Cause

This behavior is caused by an underlying limitation of Microsoft Edge WebView2 rather than a PowerBuilder-specific bug. The same behavior occurs when using third-party WebView2 ActiveX controls, such as AntView, and in non-PowerBuilder applications.

https://github.com/MicrosoftEdge/WebView2Feedback/issues/5184


Resolution

The following workarounds can be used to avoid this issue:

  1. Avoid Window-Level SetRedraw() Calls: Refactor the application code to avoid calling SetRedraw() directly on the Window object. Instead, apply SetRedraw() to individual controls that require refreshing. For example, dw_1.SetRedraw().
  2. Toggle WebBrowser Control Visibility Based on Window Activation: Dynamically toggle the visibility of the WebBrowser control based on the window's activation events:
  • In the Activate event: wb_1.Visible = true
  • In the Deactivate event: wb_1.Visible = false



 

0
0