-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Added InputTextHinted #2400
Added InputTextHinted #2400
Conversation
imgui_widgets.cpp
Outdated
} | ||
} else { | ||
if (!*is_user_data) { | ||
ImGuiInputTextState& state = GImGui->InputTextState; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized I'm not checking if state.ID == id
Is it necessary here, or is it implied by the fact that id == GetActiveID()
?
Hello Lucas, Thanks a lot for the PR. This is a good idea and I would like to support it.
I would suggest checking it because in your case the active id could be set externally. Here's my feedback:
-Omar |
Hello Omar Alright I'll go and move this to I was thinking around if it would be better for the hint to disappeared only when the user typed at least one char, as opposed to when the user activates the field (as it is rn). What do you think should be the preferred behavior ? |
Let's do it when the user typed at least one char. |
Alright, shall be good Do you want me to squash & force push ? |
I can squash on github after reviewing. The diff looks nicer now 👍🏼 |
I should update my settings, I guess
buf_display = hint; | ||
buf_display_end = hint + strlen(hint); | ||
buf_display = hint; | ||
buf_display_end = hint + strlen(hint); | ||
text_color = ImGuiCol_TextDisabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an .editorconfig
file in the root directory which is a semi standard way of passing information to your code editor after how to handle tabs/spaces.
Have a look to see if your text editor needs a plugin for it: https://editorconfig.org/
I noticed this doesn't work properly with the EDIT It is difficult because mouse and keyboard interaction need to know the font, and selecting the password/non-password font needs to know which field we are displaying. |
…y with password. This commit is aimed at having no visible side effect. (#2400)
Hello @Organic-Code , this is now merged with a couple of changes to InputText to make it work with passwords. It was a little tricky to get this right so I hope i didn't break anything in InputText... Also renamed the function to EDIT Sorry it looks like my amends/rebase messed up with the commit attribution :( I'll see if i can try to fix it. |
Squashed commit of the following: commit 1970d84 Author: Lucas Lazare <lazarelucas@yahoo.fr> Date: Tue Mar 5 12:20:39 2019 -0500 Removing sneaky tabulations #2 (why, editor T-T) I should update my settings, I guess commit 219bdfc Author: Lucas Lazare <lazarelucas@yahoo.fr> Date: Tue Mar 5 12:17:27 2019 -0500 Removing useless check introduced in b0d172 commit 8afd7a2 Author: Lucas Lazare <lazarelucas@yahoo.fr> Date: Tue Mar 5 11:49:24 2019 -0500 Removing sneaky tabulations commit 8e04908 Author: Lucas Lazare <lazarelucas@yahoo.fr> Date: Tue Mar 5 11:45:13 2019 -0500 Moving InputTextHinted code to InputTextEx commit b0d1723 Author: Lucas Lazare <lazarelucas@yahoo.fr> Date: Tue Mar 5 00:23:02 2019 -0500 C++11 to C++98 commit 9afeae3 Author: Lucas Lazare <lazarelucas@yahoo.fr> Date: Mon Mar 4 23:43:28 2019 -0500 Added InputTextHinted
Fixed it and did a force-push to update the commit attribution |
Nice! ( I was looking for a widget like this). Question: Are we going to support this behaviour for other input boxes e.g input int/float/combo box etc? |
Input Int/Float are never empty. |
This PR adds the InputTextHinted widget. It works as a regular InputText, but with a hint
It's more of an eye candy than an actually useful widget, but while doing a text field to filter logs for a terminal, I thought this way of "labeling" was prettier.
I'm not very familiar with ImGui internal code base, so my apologizes if I coded something the wrong way