imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Support char 'x' for ImGuiInputTextFlags_CharsHexadecimal

Open Halen84 opened this issue 6 months ago • 0 comments

Version/Branch of Dear ImGui:

Version 1.91.0, Branch: master

Back-ends:

Compiler, OS:

Full config/build information:

No response

Details:

My Issue/Question:

I'm not sure if this is a intentional design choice so I didn't create a PR for this

It would be nice if ImGuiInputTextFlags_CharsHexadecimal supported char 'x' for inputs. This can be implemented by changing some code in InputTextFilterCharacter() in imgui_widgets.cpp (See code below)

However, the code below would allow 'x' to be placed anywhere, so improvements can be made here if you so desire

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

// Allow x 0-9 a-F A-F
if (flags & ImGuiInputTextFlags_CharsHexadecimal)
    if (c != 'x' && !(c >= '0' && c <= '9') && !(c >= 'a' && c <= 'f') && !(c >= 'A' && c <= 'F'))
        return false;

Halen84 avatar Aug 18 '24 17:08 Halen84