Create a child window

Updated: April 19, 2023

Use screen_create_window_type() to create a child window. A window of type SCREEN_CHILD_WINDOW must be associated with a parent so that it can be visible on a display.

To create a child window:
  1. Create a variable for each of the context and window instances
    screen_context_t    screen_context = 0;
    screen_window_t     screen_child_window = 0;
                        
  2. Create a context. The context describes the relationship between the application and the underlying windowing system.
    screen_create_context(&screen_context, SCREEN_APPLICATION_CONTEXT);
                        
  3. Create a child window. The screen_create_window_type() function takes the window and context variables and an integer representing the window type. In this case, the window is of type SCREEN_CHILD_WINDOW.
    int wintype = SCREEN_CHILD_WINDOW;
    screen_create_window_type(&screen_child_window, screen_context, wintype );
                        
  4. Join the parent's window group. The window_group_name must be determined by the parent window. Usually, this is the SCREEN_PROPERTY_ID property of the parent window.
    screen_join_window_group(screen_child_window, window_group_name);