Text input and keyboard trouble

I have only recently started with corona sdk and to be honest don’t really know its intricate workings as of yet.
I am looking to make a game whereby I can input text using a keyboard but have everything previously typed and entered displaying above the text input field and accessible to read by scrolling back up. Equally I need to know what function I would require to create if/else type strings to respond to what’s been typed. It seems as though it should be a relatively easy concept but I haven’t been able to find much help on the subject.
Thanks guys :slight_smile: [import]uid: 185634 topic_id: 32212 reply_id: 332212[/import]

if textBox.text == “hi” then
print “hi back”
end

Something like that, you mean? I’m having trouble understand what your goal is. I read through this twice but not sure I’ve got it. Does the above make sense to you? (I *think* that is what you are asking.) [import]uid: 52491 topic_id: 32212 reply_id: 128528[/import]

if textBox.text == “hi” then
print “hi back”
end

Something like that, you mean? I’m having trouble understand what your goal is. I read through this twice but not sure I’ve got it. Does the above make sense to you? (I *think* that is what you are asking.) [import]uid: 52491 topic_id: 32212 reply_id: 128528[/import]

Thanks Peach,

I’m looking to be able to type on the screen and have it display as I do. Then when a phrase is entered I can have a corresponding text input field come up just below the original (whilst still displaying everything already typed above) but with a title. Maybe a little difficult to explain without an example…

Here goes :slight_smile:

On the screen it would look like this:

go home

–this would have originally been a blank text input field
–when the phrase “go home” is entered, a new title appears below it

E.g

home> (this section would then be another text input field)

–this way I could then type again for a further section to appear below again

E.g.

home>go files

–and when entered it would then display

home\files>(this section would again be a further text input field)

–this would all need to be scrolling so as the player could reference the things above
–as such, without the notes, when you get to the end of this example, the player would only
–see displayed:

go home
home>files
home\files>

Of course I’m not sure how to arrange any of this correctly and I’m going just a little nuts trying to work it out :slight_smile:

Thanks [import]uid: 185634 topic_id: 32212 reply_id: 128639[/import]

I guess maybe something that starts like this, you mean?

[lua]local field1 = native.newTextField(10, 10, 200, 20)

local function input1(event)
if event.phase == “submitted” then
if field1.text == “home” and field2 == nil then
field2 = native.newTextField(10, 40, 200, 20)
end
end
end
field1:addEventListener(“userInput”, input1)[/lua]

If you enter “home” you’ll see a new text box appear below, if it doesn’t already exist.

Does this help you at all? It’s very hard to understand some of this :wink:

Peach [import]uid: 52491 topic_id: 32212 reply_id: 128694[/import]

Thanks Peach,

I’m looking to be able to type on the screen and have it display as I do. Then when a phrase is entered I can have a corresponding text input field come up just below the original (whilst still displaying everything already typed above) but with a title. Maybe a little difficult to explain without an example…

Here goes :slight_smile:

On the screen it would look like this:

go home

–this would have originally been a blank text input field
–when the phrase “go home” is entered, a new title appears below it

E.g

home> (this section would then be another text input field)

–this way I could then type again for a further section to appear below again

E.g.

home>go files

–and when entered it would then display

home\files>(this section would again be a further text input field)

–this would all need to be scrolling so as the player could reference the things above
–as such, without the notes, when you get to the end of this example, the player would only
–see displayed:

go home
home>files
home\files>

Of course I’m not sure how to arrange any of this correctly and I’m going just a little nuts trying to work it out :slight_smile:

Thanks [import]uid: 185634 topic_id: 32212 reply_id: 128639[/import]

I guess maybe something that starts like this, you mean?

[lua]local field1 = native.newTextField(10, 10, 200, 20)

local function input1(event)
if event.phase == “submitted” then
if field1.text == “home” and field2 == nil then
field2 = native.newTextField(10, 40, 200, 20)
end
end
end
field1:addEventListener(“userInput”, input1)[/lua]

If you enter “home” you’ll see a new text box appear below, if it doesn’t already exist.

Does this help you at all? It’s very hard to understand some of this :wink:

Peach [import]uid: 52491 topic_id: 32212 reply_id: 128694[/import]