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

Align text in InputText to the right when not active #4391

Closed
keszegh opened this issue Aug 3, 2021 · 3 comments
Closed

Align text in InputText to the right when not active #4391

keszegh opened this issue Aug 3, 2021 · 3 comments

Comments

@keszegh
Copy link

keszegh commented Aug 3, 2021

After searching a lot i still do not see a way to align the text in an inputtext to the right. this would be useful e.g. in a file viewer when the text does not fit then the end of the text contains more useful information than the beginning, so that is the one which should be visible.
is this possible somehow? if not, then please consider adding it via a flag or some other way.

while trying to find workarounds i thought about modifying (truncating) the text when editing is finished and then putting back the 'long' text and positioning at the right place the cursor in the long text when editing is started. for these i'd need some callbacks when editing is started/finished but i could not find such. isItemActivated and isItemDeactivatedAfterEdit are triggered at the right time but from these i don't know how to reach the text buffer of the inputtext (and positioning the cursor), is this possible? if not, i think some way to change the text buffer when editing is started/finished (e.g. using a callback) would be a useful addition in general, not just for my usecase.

@keszegh keszegh changed the title possibiltiy to align text in InputText to the right when not active possibility to align text in InputText to the right when not active Aug 3, 2021
@ocornut
Copy link
Owner

ocornut commented Dec 7, 2023

Same as #1442 #1440 which is still open, so I'd suggest moving the discussion there.

@ocornut ocornut closed this as completed Dec 7, 2023
@ocornut ocornut reopened this Dec 7, 2023
@ocornut
Copy link
Owner

ocornut commented Dec 7, 2023

Reopening as in fact this is different from #1442: if the aim is to e.g. see the significant portion of a filename then it doesn't necessarily mean we want to right-align the text at all time (although that if available would be a good workaround, but look odd when the filename is short).

(Also see WIP stuff such as #5791 (comment))

@ocornut ocornut changed the title possibility to align text in InputText to the right when not active Align text in InputText to the right when not active Dec 7, 2023
@ocornut ocornut added this to the v1.92 milestone Dec 9, 2024
@ocornut
Copy link
Owner

ocornut commented Dec 9, 2024

This is now supported with ImGuiInputTextFlags_ElideLeft flag.
See #1442 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants