Change InputText programmatically when pressing a button (keep InputText state and insert character at the cursor position) #5219

Open
opened 2022-04-20 07:00:29 +00:00 by mihaibv123 · 0 comments
mihaibv123 commented 2022-04-20 07:00:29 +00:00 (Migrated from github.com)

I have a problem with an ImGui::InputText for which I would like to change the text displayed by using a Virtual Keyboard (also created with ImGui). I have a window containing the InputText and another one containing the virtual keyboard (both inside an SDL window).

When I press the buttons on the virtual keyboard I change the buffer I attached to the InputText by adding a character at the end of it. Is there a nicer way to alter the InputText content by taking into account also the position of the cursor inside it and keeping the state of the input text cursor?

I'm a newbie here, sorry if I didn't follow all the guidelines for this question.

I have a problem with an ImGui::InputText for which I would like to change the text displayed by using a Virtual Keyboard (also created with ImGui). I have a window containing the InputText and another one containing the virtual keyboard (both inside an SDL window). When I press the buttons on the virtual keyboard I change the buffer I attached to the InputText by adding a character at the end of it. Is there a nicer way to alter the InputText content by taking into account also the position of the cursor inside it and keeping the state of the input text cursor? I'm a newbie here, sorry if I didn't follow all the guidelines for this question.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#5219
No description provided.