Keyboard Input / Fill in with table value
tswartz
Member Posts: 24
I have an actor displaying text from a table. On touch, keyboard input opens and allows the user to change the default text, then saving it back to the table. The keyboard input obviously opens with a blank input screen.
Is it possible to fill the keyboard input text in from the table? I'd like it to remain the old value until changed (e.g., if the default is "123" I'd like the keyboard input to be filled in with "123" when opened, instead of "").
Is it possible to fill the keyboard input text in from the table? I'd like it to remain the old value until changed (e.g., if the default is "123" I'd like the keyboard input to be filled in with "123" when opened, instead of "").
Answers
Make a table, have two ROWS - first one for the "Headline" and the second for the "Keyboard Input Textfield".
Add the text you like in the two ROWS.
Add two LOCAL text attributes called eg. FROM TABLE and COMPARE TEXT.
Make a rule:
When ALL - TOUCH is pressed
- Change Attribute: self. From Table to tableCellValue(YOURTABLE,2,1)
- Keyboard Input: Change Attribute: self.From Table
Keyboard Promt: tableCellValue(YOURTABLE,1,1)
This way you will have the original text from the TABLE and being able to add or change the text.
But this has only changed the self.FROM TABLE attribute.
To save it make a new rule (outside the TOUCH rule above):
When ALL - Attribute: self.COMPARE TEXT is self.FROM TABLE (do nothing)
Otherwise
Change Table Value:
- ROW: 2
- COL: 1
- Value: self.FROM TABLE
Save Table: YOUR TABLE
Hope this helps to solve your problem.
BR,
Henrik
Are you changing your Table value at the end with a Change Attribute: set self.FromTable to self.Compare Text or do I have that backwards? I still don't see why I don't even get the prompt with the keyboard input. I like your set up though. Just not working for me.
Instead of all this code I should just have linked to the file a made!!
Get it here: http://dl.dropbox.com/u/12878764/Save Keyboard Input to Table.zip
When ALL - TOUCH is pressed
- Change Attribute: self. From Table to tableCellValue(YOURTABLE,2,1)
- Change Attribute: self. Compare Text to tableCellValue(YOURTABLE,2,1)
- Keyboard Input: Change Attribute: self.Compare Text
Keyboard Promt: tableCellValue(YOURTABLE,1,1)
When ALL - Attribute: self.COMPARE TEXT is self.FROM TABLE (do nothing)
Otherwise
Change Table Value:
- ROW: 2
- COL: 1
- Value: self.COMPARE TEXT
Save Table: YOUR TABLE
HC
A bad thing, trying to help other people and making mistakes!!
1) User inputs text. Obviously saved to the table using the above.
2) User goes back to the text, to change it for example. Right now, the text box is blank and you'd need to retype everything to "edit" your text. I'd like the preexisting text to show for edits (e.g., making it possible to delete a letter or add a paragraph WITHOUT retyping everything else).
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
DUDES!!! This is dope. Thanks GameBrothers for this post, very informational and clever. On my project I needed to display the value as well as click on the area and change it. I ended up using two actors, one in the back to simply display the value of the table, then one invisible one on top when pressed changed the table value.
-LewisOne (My Website, FB, Twitter, IG, YT)