The SDL_WINDOW_TOOLTIP
and SDL_WINDOW_POPUP_MENU
flags in SDL are designed for specific types of utility windows, each tailored to different use cases.
SDL_WINDOW_TOOLTIP
This flag is used for creating tooltip windows. Tooltip windows are lightweight, secondary windows that provide brief, contextual information.
They cannot grab input focus or be minimized. This makes them ideal for hovering text or information displays that accompany a cursor. Here’s an example:
SDL_CreateWindow("Tooltip",
100, 100, 200, 50, SDL_WINDOW_TOOLTIP);
SDL_WINDOW_POPUP_MENU
This flag is intended for dropdown menus or similar UI elements. Unlike tooltips, popup menus often require interaction, so they can grab input focus.
They’re used for context menus or dropdowns that are triggered by user actions, like a right-click or a button press. Here’s an example:
SDL_CreateWindow("Dropdown",
100, 100, 200, 150, SDL_WINDOW_POPUP_MENU);
The key difference is the intended interaction model: tooltips are passive and display-only, while popup menus are interactive and often capture user input.
Both types benefit from being combined with other flags, such as SDL_WINDOW_HIDDEN
to manage visibility dynamically or SDL_WINDOW_ALWAYS_ON_TOP
to ensure they appear above other windows.
Answers to questions are automatically generated and may not have been reviewed.
Learn how to manage multiple windows, and practical examples using utility windows.