mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-14 19:04:44 +00:00
How to uppercase the first char on an ImGui::InputText() with std::string using imgui_stdlib.h? #6457
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#6457
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Version/Branch of Dear ImGui:
Version: v1.89.4
Branch: master
Back-end/Renderer/Compiler/OS
Back-ends: OpenGL/ openFrameworks
Compiler: VS 2022
Operating System: Windows10
My Issue/Question:
I am using
imgui_stdlib.hto simplify the use of an std::string as text target...I'm trying to do it with an ImGui::InputText but also on the hint version and multiline too.
(not at the same time, just one of the three.)
Standalone, minimal, complete and verifiable example
I am dealing with exceptions that I can't solve.
Any example or idea around this?
The commented code is not how to use ImGuiInputTextFlags_CallbackCharFilter. Please refer to demo code using it.
My apologies. This is only partially covered in the demo:
ImGuiInputTextFlags_CallbackCharFilteris used but not for character replacement.You can read
data->EventCharand change it if you want, the modified character will then be inserted.The only source of documentation for this is the flags description:
I will work on amending the demo to showcase replacement along with filtering.
Otherwise you can use
ImGuiInputTextFlags_CallbackEditand then alter Buf[0] and set BufDirty like you tried to above.I have improved the demo
7947f32And confirmed that to do what you want, it is best to use
ImGuiInputTextFlags_CallbackEdit:Super. Thanks.
It worked fine.
EDIT: converted to lambda
A bit hard to me to understand all that callback and pointer data stuff... I need to check deeper.
PS
How could I get when a key is pressed to trig a sound player?Sorry. Callback is trigged when a pressed key, so it can be used to trig a sound here. Better than listen to key events and so maybe...
But how can I pass [this] or a boolean to flag or trig the sound from inside the function?