Set a context property

You can get and set context properties in order to define how your application will behave within a window.

In Screen API, many get and set methods contain multiple variants, with each variant corresponding to the type that is associated with a property. For example, the screen_get_context_property_iv() method takes an integer, while the screen_get_context_property_llv() takes a long long integer.

To set a context property:

  1. Create a variable to pass into the function. The type must match the variant of the function, and the value must represent a valid flag. In the example below, a Screen format flag is passed into the function.
    int context_idle = 5;
  2. Call the variant function. The screen_set_context_property_iv() function takes a reference to an integer that determines the length of time in seconds before the window will timeout.
    if (screen_set_context_property_iv(screen_context, SCREEN_PROPERTY_IDLE_TIMEOUT, &context_idle) !=0) {
            return EXIT_FAILURE;
You can flush the context of any delayed commands by calling the screen_flush_context() function. When you call the screen_flush_context() function, any delayed commands are processed from the buffer, and any associated displays are updated. If you specify the SCREEN_WAIT_IDLE parameter, the function will not return until all associated displays have been updated.
if (screen_flush_context(screen_context, SCREEN_WAIT_IDLE) !=0) {
        return EXIT_FAILURE;

When debugging your application, it's a good idea to call the screen_flush_context() function after you call any delayed function. This will help you to determine the exact function call that caused the error.