Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
gdevelop5:objects:text_entry [2018/10/10 20:20] valiant_curiosity [Add text entry object] |
gdevelop5:objects:text_entry [2019/06/13 14:13] piyushpalawat99 |
||
---|---|---|---|
Line 1: | Line 1: | ||
# Text entry object | # Text entry object | ||
+ | |||
+ | <note tip> | ||
+ | [[# | ||
+ | </ | ||
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. | 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. | ||
Line 6: | Line 10: | ||
==== Add text entry object ==== | ==== Add text entry object ==== | ||
- | After creating a new object from the Objects Editor list, select " | + | After creating a new object from the Objects Editor list, select " |
{{ : | {{ : | ||
- | Rename the Text Entry object to whatever you like. Add the Text Entry object to the scene. | + | Rename the Text entry object to whatever you like. Add the Text entry object to the scene. |
- | Now, if you run a preview of the scene, 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 the Events Editor to create | + | Now, if you run a preview of the scene, 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 ==== | ==== 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: | First, add a Text Object to the scene. Then, add an event to modify the content of the Text object: | ||
+ | |||
{{ : | {{ : | ||
For the last parameter, which is the new content for the text, use the expression mentioned above: | For the last parameter, which is the new content for the text, use the expression mentioned above: | ||
- | {{ : | + | {{ : |
- | //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 | + | Now if you run a scene preview. Start typing you will 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 | + | Using events, it is possible to enable or disable the " |
+ | |||
+ | {{: | ||
Line 33: | Line 41: | ||
Open these examples online.</ | Open these examples online.</ | ||
- | {{ : | + | {{: |
* https:// | * https:// | ||
- |