Differences

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

Link to this comparison view

gdevelop5:objects:text_entry [2018/10/10 20:15]
valiant_curiosity [Text entry object]
gdevelop5:objects:text_entry [2020/12/26 13:56]
Line 1: Line 1:
- 
-# Text entry object 
- 
-The text entry object captures user input and stores it in memory. You can use this object to simulate text input fields. For example, you might use the text entry object to provide a way that the player of your game can enter his/her name or any other information. 
- 
-==== Add text entry object ==== 
- 
-To add a Text Entry object, select it from the list when creating a new object: 
-{{ :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 are 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 like this one: `TextEntry.String()` (see an example below). 
- 
-==== Display value using a text object ==== 
- 
-First, add a Text Object to the scene. Then, add an event to modify the content of the Text object: 
-{{ :gdevelop5:objects:text-entry-object-display-value.png?nolink }} 
- 
-For the last parameter, which is the new content for the text, use the expression mentioned above: 
-{{ :gdevelop5:objects:text-text-entry.png?nolink&400 |}} 
- 
-//Note that __Entry__ should be the name of the Text Entry object. You need to replace this 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, it is possible to enable or disable the text entry object, to control when capturing input and when not to. 
- 
- 
-## Examples  
- 
-<note tip>**See it in action!** 🎮\\ 
-Open these examples online.</note> 
- 
-{{ :gdevelop5:objects:textexample.png?400 |}} 
- 
-* https://editor.gdevelop-app.com/?project=example://text-entry-object