# Text input allowing modifying a value (SOLVED)

**URL:** <https://forum.defold.com/t/text-input-allowing-modifying-a-value-solved/72152>\
**Category:** Questions\
**Created:** [November 29, 2022, 11:20am UTC](https://forum.defold.com/t/text-input-allowing-modifying-a-value-solved/72152 "2022-11-29T11:20:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![totebo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/totebo/32/36087_2.png) [@totebo](https://forum.defold.com/u/totebo)\
**Post date:** [November 29, 2022, 11:20am UTC](https://forum.defold.com/t/text-input-allowing-modifying-a-value-solved/72152/1 "2022-11-29T11:20:08Z")

</div>

For debugging I’d like to change a date stamp text field in my game at runtime, like in this video:

After a little digging there doesn’t seem to be an easy way to do this in Defold?

The most basic example doesn’t have a cursor:

> **[Text input](https://defold.com/examples/input/text/)**
>
> Listens to text input trigger

Druid doesn’t seem to have a cursor:  
[https://insality.github.io/druid/druid/?example=general\_input](https://insality.github.io/druid/druid/?example=general_input)

Dear IMGUI doesn’t seem to have a text input component:

> <https://github.com/britzl/extension-imgui/blob/master/example/example.script>

Gooey also doesn’t seem to have cursor support:

> **[Gooey 1.0](https://britzl.github.io/Gooey/)**

Is there a different simple approach that I’m missing?

---

<div class="post-metadata">

**Author:** ![Insality](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/insality/32/39737_2.png) [@Insality](https://forum.defold.com/u/Insality)\
**Post date:** [November 29, 2022, 12:12pm UTC](https://forum.defold.com/t/text-input-allowing-modifying-a-value-solved/72152/2 "2022-11-29T12:12:02Z")

</div>

For now I didn’t see any solution for cursors in input fields

But I’m sure it’s possible to do even with just single text with `resource.get_text_metrics`, but can be a little tricky 🙂

---

<div class="post-metadata">

**Author:** ![totebo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/totebo/32/36087_2.png) [@totebo](https://forum.defold.com/u/totebo)\
**Post date:** [November 29, 2022, 1:46pm UTC](https://forum.defold.com/t/text-input-allowing-modifying-a-value-solved/72152/3 "2022-11-29T13:46:15Z")

</div>

I’m using Druid (awesome, btw!) and in the end I just split the date up into separate text inputs for year, month, day etc. A bit clunky, but works.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [November 29, 2022, 2:01pm UTC](https://forum.defold.com/t/text-input-allowing-modifying-a-value-solved/72152/4 "2022-11-29T14:01:13Z")

</div>

> [@totebo](#):
>
> Dear IMGUI doesn’t seem to have a text input component

Hmm, it should have one… let me check…

(a few moments later)

Yes there is `imgui.input_text(label, text, [flags])` (and it does have cursor support)!

> <https://github.com/britzl/extension-imgui/blob/master/imgui/api/imgui.script_api#L643-L656>

---

<div class="post-metadata">

**Author:** ![totebo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/totebo/32/36087_2.png) [@totebo](https://forum.defold.com/u/totebo)\
**Post date:** [November 29, 2022, 3:11pm UTC](https://forum.defold.com/t/text-input-allowing-modifying-a-value-solved/72152/5 "2022-11-29T15:11:25Z")

</div>

> [@britzl](#):
>
> Yes there is `imgui.input_text(label, text, [flags])` (and it does have cursor support)!

Amazing, thanks! It works a treat.
