video_display_set_caption video_display_add_menu_separator navigation bar

Table of Contents

video_display_add_menu_item

Add a menu item to the context menu of the specified video display window.

Description

The video_display_add_menu_item function adds a custom menu item to the context menu of the given video display window. The menu item is given the specified name and the callback is invoked when the menu item is selected.

Prototype

t_error
video_display_add_menu_item(t_video_window window, const char * name, t_video_display_menu_callback callback);
    

Parameters

t_video_window window

The handle to the window returned by video_display_open.

const char * name

A string containing the name of the menu item.

t_video_display_menu_callback callback

A pointer to a callback function that is invoked when the context menu item is selected. The callback is passed the window handle as an argument.

Return value

The return value is 0 if the menu item is added successfully. Otherwise a negative error code is returned. Error codes are defined in quanser_errors.h. A suitable error message may be retrieved using msg_get_error_message.

Error codes

QERR_OUT_OF_MEMORY

There is not enough memory to complete the operation.

Requirements

Include Files

Libraries

quanser_video.h

quanser_media.lib;quanser_communications.lib;quanser_runtime.lib;quanser_common.lib

Examples

static void callback(t_video_window window) {
    /* ... Menu item has been selected ... */
}

t_error setup_menu() {
    result = video_display_add_menu_item(window, "Click bait", callback);
    ...
    return result;
}
    

See Also

 

navigation bar