Page 1 of 1
self opening keyboard
Posted: Thu Jan 22, 2015 4:01 pm
by ronbird
Hi all,
Working on an Android application and I'm trying to have a keyboard open automatically on openCard. I dont want the user to have to touch the text field to have to launch the keypad, I want the keypad to be there when the card opens. Can anyone help? Thanks Ron.
Re: self opening keyboard
Posted: Thu Jan 22, 2015 4:05 pm
by Klaus
Hi Ron,
not sure, but since the keyboard will only pop up when a text entry field is opened,
you should try something like this:
Code: Select all
on opencard
focus on fld "name of your field here"
...
## or maybe:
## select text of fld "name of your field here"
## or
## select BEFORE text of fld ...
## select AFTER text of fld ...
end opencard
Best
Klaus
Re: self opening keyboard
Posted: Thu Jan 22, 2015 5:29 pm
by ronbird
on opencard
focus on fld "name of your field here"
end opencard
works a treat, I did not realise it would be so easy.
Thanks Ron
Re: self opening keyboard
Posted: Thu Jan 22, 2015 7:18 pm
by ronbird
supplemental

I have focus in the first field, the keyboard automatically opens and on pressing return I can move to the next field.
The next press of return I want to go to the next card. I wrote this (and many others like it):
on returninfield
--
if environment() = "mobile" then
if focus = "Field_Phone#" then
focus on fld "field_amount"
end if
end if
--
if focus = fld "field_amount" then
go next
end if
--
end returninfield
but this does not work. Any leads please, thanks Ron
Re: self opening keyboard
Posted: Thu Jan 22, 2015 10:02 pm
by Klaus
Hi Ron,
FOCUS is a command, not a property, use "the selectedfield", see dictionary.
Try something like this:
Code: Select all
on returninfield
..
## I avoid nested IFs wherever I can :-)
if environment() <> "mobile" then
pass returninfield ## or EXIT returninfield
end if
if the short name of the selectedfield = "Field_Phone#" then
focus on fld "field_amount"
end if
--
if the short name of the selectedfield = fld "field_amount" then
go next
end if
--
end returninfield
Best
Klaus
Re: self opening keyboard
Posted: Fri Jan 23, 2015 10:49 am
by ronbird
Well this is interesting....
The code you suggest navigates from one field to the next but does not navigate to the next page.
I noticed that line 7 misses out 'fld'
'if the short name of the selectedfield = "Field_Phone#" then'
so I removed it from
'if the short name of the selectedfield = fld "field_amount" also.
Then the code navigated from the first field "Field_Phone#" to the next page missing out the field "field_amount"
I placed the term 'fld' from the line it was missing from, and then nothing happens.
Moving from a field to another page is important, and I can fake the look to make it appear the user is still on the same page, and has only moved from one field to the next. Due to time constraints this is the route I shall take.
However I shall look at the script later to see if I can get it to work correctly.
Thanks for your help Klaus, Ron
Re: self opening keyboard
Posted: Fri Jan 23, 2015 1:19 pm
by Klaus
Hi Ron,
yep, sorry, one "fld" was too much and "made in a hurry".
The SHORT name of an object does of course not contain its TYPE decriptor, but you knew that
And I did not suggest code, only correct syntax.
No idea if that really works, however opening a field to go to the next card does not seem to be the right way to me.
Best
Klaus
Re: self opening keyboard
Posted: Tue Mar 10, 2015 3:14 pm
by ronbird
hi all
I've used the code below once before and it worked.
I'm trying to use the same code again and when I press the Android keyboard return all I get is a return in the selected field and not navigating to the next card. Any thoughts as to where I've gone wrong? You will see in the code I've tried various options, and more than you see there.
Trial file, Keypad1.livecode.zip, uploaded
on returninfield
--
if environment() <> "mobile" then
pass returninfield
## or EXIT returninfield
end if
--
--if the autoTab of the target then
--go next card
--end if
--
--if the short name of the selectedfield = field "field3" then
if the short name of the selectedfield = "field3" then
go next
end if
--
end returninfield
Re: self opening keyboard
Posted: Wed Mar 11, 2015 11:51 am
by ronbird
Ok. I've sorted it, and the answer is:
--
on returninfield
--
if environment() <> "mobile" then
answer "is environmentmobile?"
pass returninfield
end if
--
if the short name of the selectedfield = "field3" then
go card"ONE"
end if
--
end returninfield

Re: self opening keyboard
Posted: Wed Mar 11, 2015 11:52 am
by ronbird
Ok. I've sorted it, and the answer is:
--
on returninfield
--
if environment() <> "mobile" then
pass returninfield
end if
--
if the short name of the selectedfield = "field3" then
go card"ONE"
end if
--
end returninfield

Re: self opening keyboard
Posted: Wed Mar 11, 2015 7:23 pm
by jacque
Glad it's working, but be aware that naming cards as numbers is a bad idea that can cause all kinds of trouble later. The quotes around the name save you in this case, but it would still be better to use a different name if you can.