Adding support of InputTextWithHint to ImGuiTextFilter. #6395

Closed
opened 2023-05-03 02:42:27 +00:00 by reworks-org · 0 comments
reworks-org commented 2023-05-03 02:42:27 +00:00 (Migrated from github.com)

Version/Branch of Dear ImGui: 1.89.5

My Issue/Question:

Adding support of InputTextWithHint to ImGuiTextFilter.

Thought this might be useful to anyone else who wanted similar support.

Add:

IMGUI_API bool      DrawWithHint(const char* label, const char* hint = "Filter (inc,-exc)", float width = 0.0f);

to ImGuiTextFilter struct. Then in ImGui.cpp, add

bool ImGuiTextFilter::DrawWithHint(const char* label, const char* hint, float width)
{
    if (width != 0.0f)
        ImGui::SetNextItemWidth(width);
    bool value_changed = ImGui::InputTextWithHint(label, hint, InputBuf, IM_ARRAYSIZE(InputBuf));
    if (value_changed)
        Build();
    return value_changed;
}

you should do this under ImGuiTextFilter::Draw.

Maybe we could get this added to ImGui officially? 😉

**Version/Branch of Dear ImGui:** 1.89.5 **My Issue/Question:** Adding support of InputTextWithHint to ImGuiTextFilter. Thought this might be useful to anyone else who wanted similar support. Add: ``` IMGUI_API bool DrawWithHint(const char* label, const char* hint = "Filter (inc,-exc)", float width = 0.0f); ``` to ImGuiTextFilter struct. Then in ImGui.cpp, add ``` bool ImGuiTextFilter::DrawWithHint(const char* label, const char* hint, float width) { if (width != 0.0f) ImGui::SetNextItemWidth(width); bool value_changed = ImGui::InputTextWithHint(label, hint, InputBuf, IM_ARRAYSIZE(InputBuf)); if (value_changed) Build(); return value_changed; } ``` you should do this under ImGuiTextFilter::Draw. Maybe we could get this added to ImGui officially? 😉
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#6395
No description provided.