pthom / hello_imgui

Hello, Dear ImGui: unleash your creativity in app development and prototyping
https://pthom.github.io/hello_imgui
MIT License
604 stars 91 forks source link

Is there a way to make input_text to show only the last part of the text while deactivated #90

Closed juseus03 closed 5 months ago

juseus03 commented 5 months ago

Hi,

I am displaying a long path in a input_text widget, since the user should be able to edit it. As it is really long, I would like to display only the last part of the path, something like:

path_example

I've tried using the callbacks and setting the cursor position, but then, this doesn't allow any editing because the cursor is always at the end. Any idea how to do it?

pthom commented 5 months ago

Hello,

This is a more question related to ImGui I guess, and by searching in the issues, you can find this. As far as I saw, it may be not possible.

But, you would need to search for a file dialog library, such as portable-file-dialogs or ImFileDialog , which by the way are provided directly inside the sister library ImGui Bundle

pthom commented 5 months ago

while deactivated

You can detect its state and change the content based on "is it activated or not". This + ImGui::CalcTextSize