Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design rational for requireing a non-empty string as window title #7434

Closed
milasudril opened this issue Mar 24, 2024 · 3 comments
Closed

Design rational for requireing a non-empty string as window title #7434

milasudril opened this issue Mar 24, 2024 · 3 comments
Labels
label/id and id stack implicit identifiers, pushid(), id stack

Comments

@milasudril
Copy link

Version/Branch of Dear ImGui:

Version 1.86

Back-ends:

OpenGL + GLFW

Compiler, OS:

g++-11, Mint 21.2

Full config/build information:

No response

Details:

My Issue/Question:
Why is it illegal to use an empty or null string when creating a window?

Screenshots/Video:

imgui.cpp:5948: bool ImGui::Begin(const char*, bool*, ImGuiWindowFlags): Assertion `name != __null && name[0] != '\0'' failed.

This is annoying. I could understand the no-null requirement, but an empty string should be allowed, or do you do some stuff that require it to have an actual length, such as dividing by its length?

Minimal, Complete and Verifiable Example code:

No response

@ocornut ocornut added the label/id and id stack implicit identifiers, pushid(), id stack label Mar 24, 2024
@ocornut
Copy link
Owner

ocornut commented Mar 24, 2024

Windows and widgets needs to be identified somehow.

You can use "##anything" as an ID and it won’t show.

The use of empty identifier is answered in the first "Usage" section of the FAQ:
https://github.com/ocornut/imgui/blob/master/docs/FAQ.md#q-how-can-i-have-widgets-with-an-empty-label

@ocornut ocornut closed this as completed Mar 24, 2024
@milasudril
Copy link
Author

I thought you didn't have that option, because then I would expect it to return a handle. What if I want a different title than identifier?

@ocornut
Copy link
Owner

ocornut commented Mar 24, 2024

You don’t need an handler, but we need to store data internally. And also eg in the .ini file.

Your question is answered in that FAQ entry and also in some demos like Examples>Manipulating Window Titles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
label/id and id stack implicit identifiers, pushid(), id stack
Projects
None yet
Development

No branches or pull requests

2 participants