mobileFX WebKitX CEF3 ActiveX 4.x
WebKitXCEF3Lib ActiveX Control / WebKitXCEF3 Object / SetMDIWindow Method

MDI window handle.


In This Topic
    SetMDIWindow Method
    In This Topic

    Sets an MDI window handle to monitor for size and position changes in order to repaint child windows that host WebKitX browsers.

    Visual Basic
    Public Sub SetMDIWindow( _
       ByVal hWnd As Long _

    MDI window handle.



    MDI Forms in most programming languages suffer from flickering effects. When using WebKitX in an MDI child Form, you may notice rendering problems when MDI children overlap each other during resizing or moving. To treat this problem you need to add WebKitX.SetMDIWindow(hWND) in every MDI child Form that uses WebKitX control. The call installs a window sub-class hook that detects WM_WINDOWPOSCHANGING and WM_MOVING messages and repaints the entire MDI Form. In order to avoid further flickering and redundant repaints, WebKitX uses Timer that absorbs repeated WM_WINDOWPOSCHANGING and WM_MOVING messages. For SetMDIWindow() to work, the WebKitX control must be directly placed inside an MDI Child Form and must not be contained inside another control (such as a TabStrip).

    Overlapping Form Controls (re-positioning / re-z-indexing)

    When you place WebKitX control inside a TabStrip control you must control its Visibility in order to avoid rendering problems. Most TabStrip controls during page selection, instead of toggling the visibility of the pages and/or their contained controls, they simply re-position the inactive controls in a non-visible area or re-position the controls along the z-axis. However, CEF3 window is an out-of-process overlay window on-top of WebKitX COleControl window and re-positioning or re-z-indexing form controls can cause rendering problems to WebKitX and other controls in your form too.

    To avoid this problem as of version WebKitX does not resize/re-position CEF3 browser window if WebKitX control is invisible (WebKitX.Visible = False). However, there is a best practice you must follow in order to achieve the desired behavior: you need to control WebKitX visibility by code, as illustrated below. Also, we have added WebKitX.SetAutoResize(Enable) method to explicitly enable or disable CEF3 resize/re-position. Please note that to force WebKitX / CEF3 to resize/re-position after they become visible again, you must call WebKitX.Repaint() method.

    The problem described does not appear only with TabStrip controls; the same defect appears if you have custom control layouting implementation in your Forms that re-positions controls or re-indexes controls z-index.

    See Also