Download Now

    Reference Codebot.Render.Controls.Child.pas

    Part of the Codebot Render Controls package

    Codebot.Render.Controls.Child creates an SDL window and places it inside the native window of an LCL control, where it fills the control. SDL creates the OpenGL context for the window and reads its keyboard and mouse, the same as it does for the window of an SDL application.

    SDL has no child windows of its own. The window is created hidden as a top level window without a border and is then given a new parent by the window system, X11 on Linux or Windows.

    The window system only sends keys to the window with the keyboard focus, which the LCL does not know the SDL window can have. ChildFocus gives the focus to the SDL window and ChildUnfocus gives it back to the form.

    After it is created the window is only changed through the window system and never through SDL, which learns of the changes from its events. That keeps SDL from being used by the main thread while the render thread reads its events.

    The Codebot.Render.Controls.Child unit creates an SDL window and places it inside the native window of an LCL control, where it fills the control. Because SDL has no child windows of its own, the window is first created hidden as a top level window and is then given a new parent by the window system, which is X11 on Linux or Windows itself. The unit also resizes and destroys the window, and moves the keyboard focus between it and the form.

    Items 6 items

    NameKindLine
    ChildCreatefunction42
    ChildDestroyprocedure45
    ChildFocusprocedure51
    ChildFocusedfunction49
    ChildResizeprocedure47
    ChildUnfocusprocedure54