self opening keyboard
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
self opening keyboard
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.
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
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:
Best
Klaus
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
Klaus
Re: self opening keyboard
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
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
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

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
Hi Ron,
FOCUS is a command, not a property, use "the selectedfield", see dictionary.
Try something like this:
Best
Klaus
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
Klaus
Re: self opening keyboard
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
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
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
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
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
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
- Attachments
-
- Keypad1.livecode.zip
- (2.6 KiB) Downloaded 227 times
Re: self opening keyboard
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

--
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
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

--
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
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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com