Differences

This shows you the differences between two versions of the page.

Link to this comparison view

gdevelop5:objects:text_entry [2018/07/20 14:35]
4ian
gdevelop5:objects:text_entry [2020/12/26 13:56]
Line 1: Line 1:
- 
-# Text entry object 
- 
-The text entry object allow us to capture user input and store it in memory. We can use this object to simulate text input fields where the player can enter for example a player name. 
- 
-<note tip> **See it in action!** 🎮Open this example online: https://editor.gdevelop-app.com/?project=example://text-entry-object 
-</note> 
- 
-==== Add text entry object ==== 
- 
-To add a text entry object we need to select it from the list when we create a new object 
-You may need to scroll down on the list to find it 
-{{ :gdevelop5:objects:add-text-entry-object.png?nolink }} 
- 
-After, rename the object to whatever you like and simply add the object to the scene. Now if you run a preview all the keys you press is going to be captured by the object and stored in memory. In order to read the value from the memory you need to use an expression which take the form **object_name.String()** 
- 
-You can learn more about expression on the wiki 
- 
-==== Display value using a text object ==== 
- 
-Let add a text object to our scene. After let add an event to modify the text of the text object 
-{{ :gdevelop5:objects:text-entry-object-display-value.png?nolink }} 
- 
-After we just simply need to use the above mentioned expression as the text 
-{{ :gdevelop5:objects:expression-get-text-entry-value.png?nolink }} 
- 
-//Note that, __text-entry__ is my choice of name for the text entry object. You need to replace that with the name of your text entry object.// 
- 
-Now if you run a preview and start typing you should see the text object displaying whatever you type. 
- 
-Using events we can enable, disable the text entry object whenever we want and control it this way when we actually capturing input and when not to. We can also modify the value stored in memory to anything we like.