imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Single line Input box contents align right.

Open kucoman opened this issue 8 years ago • 5 comments

Added new flag: ImGuiInputTextFlags_AlignRight. Added implementation in InputTexEx().

kucoman avatar Nov 15 '17 17:11 kucoman

Hello,

Referencing your issue #1440

Some comments:

  • AFAIK this only works when not editing the text and then jumps back to the left, wouldn't that be a problem for you? That's the number one question I have.

  • If it's a flag and it doesn't work for multiline then it it should assert against that.

  • However if you are going to use this flag everywhere in your code (is that the case?), I think this could be exposed in the style structure as e.g. ImVec2 InputTextAlign (to mimic ButtonTextAlign) ?

  • The code doesn't follow the general coding style of imgui (no space after //, tabs instead of space)

(The lack of proper single-line and multi-text text alignment primitives is a long standing issue we ought to fix! Probably for an upcoming cleanup of the internals.)

Omar

ocornut avatar Nov 15 '17 17:11 ocornut

Yes, while the field is being edited, the right alignment is lost. Even with that, it considerably broadens the use for listing editable fields for numbers, in the form of a sum for instance. Good enough for me for the time being.

About the flag's assert, I believe it is already set and working. I am not sure if there is something else I missed.

As for the other considerations, this is definitely meant as a workaround more than a solution, for an emergency on my end. As you say, the issue is much deeper than just a couple lines. However, depending on when the nice way can be attended to, it might make sense to include this as a temporary convenience. Your call.

I corrected the coding style. Also, if you believe it is worth it, I might be able to find a slot for the style approach.

kucoman avatar Nov 15 '17 23:11 kucoman

We've been using this in production for a few months now, and didn't have any issues until now. Would it be possible to get this merged ? Is anything holding it back ?

Lectem avatar Jan 29 '19 15:01 Lectem

+1 for requesting this feature

forrestsmithfb avatar Aug 05 '21 23:08 forrestsmithfb

It would be great to get this feature in. In the meanwhile here's a hack that I did, which does not require changes to imgui itself (but needs access to internal data structures).

https://gist.github.com/petrihakkinen/c2462974ad41f72a54d9aaf2d62b2536

petrihakkinen avatar Jun 07 '24 14:06 petrihakkinen