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

How to hide a TextFilter's label? #6724

Closed
sodamouse opened this issue Aug 16, 2023 · 2 comments
Closed

How to hide a TextFilter's label? #6724

sodamouse opened this issue Aug 16, 2023 · 2 comments
Labels
label/id and id stack implicit identifiers, pushid(), id stack

Comments

@sodamouse
Copy link

Version/Branch of Dear ImGui:

Version: 1.89.7
Branch: Docking

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_glfw.cpp + imgui_impl.opengl3.cpp
Compiler: clang++
Operating System: Archlinux

My Issue/Question:

Hi, I am trying to figure out how to hide a TextFilter's label. I know that this can be done using Push/PopItemWidth for other widgets, but this does not seem to work for TextFilter. I have not managed to find any examples of this when searching. Is this currently possible?

Screenshots/Video

image

XXX (you can drag files here)

Standalone, minimal, complete and verifiable example: (see #2261)

ImGui::PushItemWidth(-1);
static ImGuiTextFilter filter;
(void)ImGui::PopItemWidth;
@GamingMinds-DanielC
Copy link
Contributor

Since it is a static, construction happens only once. Besides that, Item width around the construction does nothing. And the Draw() method has an explicit width already. Give it a -1.0f there, also you can skip drawing the label by starting it with ##.

filter.Draw( "##FilterID", -1.0f );

@ocornut ocornut added the label/id and id stack implicit identifiers, pushid(), id stack label Aug 16, 2023
@ocornut
Copy link
Owner

ocornut commented Aug 16, 2023

For reference this is answered in the FAQ:
https://github.com/ocornut/imgui/blob/master/docs/FAQ.md#q-how-can-i-have-widgets-with-an-empty-label

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

3 participants