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

Right-align inputtext when clipped (was: Scroll InputText to the end) #8216

Closed
1vanK opened this issue Dec 9, 2024 · 3 comments
Closed

Right-align inputtext when clipped (was: Scroll InputText to the end) #8216

1vanK opened this issue Dec 9, 2024 · 3 comments

Comments

@1vanK
Copy link

1vanK commented Dec 9, 2024

Version/Branch of Dear ImGui:

master

Details:

Is it possible to automatically scoll TextInput to the end? It's more important for me to see the file name, not the beginning of the path to it.

изображение

static StrUtf8 src_font_path = get_base_path() + "font_generator_data/fonts/ubuntu/Ubuntu-R.ttf";
ImGuiStyle& style = GetStyle();

Begin("Font");
StrUtf8 open_button_label = "...";
Text("File path");
PushItemWidth(-calc_button_width(open_button_label) - style.ItemSpacing.x);
InputText("##src_font_path", &src_font_path);
PopItemWidth();
SameLine();
Button(open_button_label.c_str());
ImGui::End();
@ocornut ocornut changed the title Scroll InputText to the end Right-align inputtext when clipped (was: Scroll InputText to the end) Dec 9, 2024
@ocornut
Copy link
Owner

ocornut commented Dec 9, 2024

It's not currently possible. Duplicate of #4391. I hope to work on it in the following few months.

@ocornut
Copy link
Owner

ocornut commented Dec 9, 2024

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

image

@1vanK
Copy link
Author

1vanK commented Dec 9, 2024

Thanks!

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