Set a context property

You can get and set context properties in order to define how your application behaves within a window. In Screen API, many get and set functions 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,
                                       &context_idle) !=0) {
        return EXIT_FAILURE;

Call screen_flush_context() to have your property take effect immediately.
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 helps you to determine the exact function call that caused the error.

Last modified: 2015-03-31

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus