The problem is that TWebView:SetSize() is designed for standalone webview windows, not for embedded child windows. Looking at the C++ implementation in webview.h, set_size() calls SetWindowPos on m_window (the webview's own window) and uses AdjustWindowRect with WS_OVERLAPPEDWINDOW โ which adds frame/border adjustments inappropriate for a child window. It also modifies the window style via SetWindowLong, which interferes with the WS_CHILD style you set via SetParent(). 1-cite-0
The existing samples that use TWebView with SetParent() do not use SetSize() for resizing. Instead, they call SetWindowPos directly on the webview's window handle: 1-cite-1 1-cite-2
Solution โ use SetWindowPos directly:
oDlg:bResized := {|| If( oWeb != nil, ;
SetWindowPos( oWeb:GetWindow(), 0, 0, 0, oDlg:nClientWidth, oDlg:nClientHeight, 4 ), ) }
The 4 is SWP_NOZORDER. This resizes the webview's window directly without the AdjustWindowRect overhead that SetSize() applies.
Alternative โ switch to TWebView2:
TWebView2:SetSize() does not have this problem because it calls pController->put_Bounds(rect) which correctly resizes the browser control within the host window: 1-cite-3
The TWebView2 samples use SetSize() for resize handling without issues: 1-cite-4