Multiple Windows and Utility Windows

Tooltip vs Popup Menu Flags

How do SDL_WINDOW_TOOLTIP and SDL_WINDOW_POPUP_MENU differ?

Abstract art representing computer programming

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.

This Question is from the Lesson:

Multiple Windows and Utility Windows

Learn how to manage multiple windows, and practical examples using utility windows.

Answers to questions are automatically generated and may not have been reviewed.

This Question is from the Lesson:

Multiple Windows and Utility Windows

Learn how to manage multiple windows, and practical examples using utility windows.

0/67 Completed0%
sdl2-promo.jpg
Part of the course:

Game Dev with SDL2

Learn C++ and SDL development by creating hands on, practical projects inspired by classic retro games

Free, unlimited access

This course includes:

  • 67 Lessons
  • 100+ Code Samples
  • 91% Positive Reviews
  • Regularly Updated
  • Help and FAQ

Exclusive Content

With our monthly newsletter

Free, Unlimited Access

Professional C++

Comprehensive course covering advanced concepts, and how to use them on large-scale projects.

Screenshot from Warhammer: Total War
Screenshot from Tomb Raider
Screenshot from Jedi: Fallen Order
Contact|Privacy Policy|Terms of Use
Copyright © 2024 - All Rights Reserved