Page 1 of 2
Android Keyboard - Using "Sentence" Option.
Posted: Thu May 29, 2025 8:08 am
by Googie85
Hii Guys!
I have in the past viewed a way to set the Android keyboard to a "Sentence" option. Essentially when a key is pressed, the character will automatically set the case to uppercase. I have searched the dictionary for "Keyboard" but can't seem to find the information I need.
Any help is greatly appreciated!
Many Thanks,
Matt.
Re: Android Keyboard - Using "Sentence" Option.
Posted: Thu May 29, 2025 8:30 am
by richmond62
I think you need to look at
toUpper.
-
-
Code: Select all
on keyDown KD
put KD into KEYD
put toUpper(KEYD) after fld "ff"
end keyDown
Re: Android Keyboard - Using "Sentence" Option.
Posted: Thu May 29, 2025 8:31 am
by Googie85
I have tried that. I would like to show a Capital on the keyboard also.
Re: Android Keyboard - Using "Sentence" Option.
Posted: Thu May 29, 2025 8:40 am
by richmond62
I don't think LiveCode can control aspects of an operating system external to itself.
Re: Android Keyboard - Using "Sentence" Option.
Posted: Thu May 29, 2025 3:20 pm
by dunbarx
Googie85:
Isn't it the case, using the "sentence" idea you mentioned, that only the first character should be capitalized? In other words, if you are creating a document and type a period and then a space, is it that you want the next character to automatically be capitalized? That can be done under script control, and you do not have to change the keyboard. In the script of the field of interest:
Code: Select all
on rawKeyUp tkey
if char - 3 to - 2 of me is ". " then put toUpper(numToChar(tkey)) into the last char of me
end rawKeyUp
Craig
Re: Android Keyboard - Using "Sentence" Option.
Posted: Thu May 29, 2025 3:30 pm
by dunbarx
All.
I used the "rawKeyUp" message in the above field handler because I cannot detect the "keyUp" message at all. That would be a simpler handler. If I try, I can see "keyDown", no problem. This is in a new stack with a single field. Just me again?
Restarting LC does not help.
Craig
Re: Android Keyboard - Using "Sentence" Option.
Posted: Thu May 29, 2025 3:45 pm
by richmond62
That WILL capitalise the first letter of all the sentences EXCEPT for the first one.
Re: Android Keyboard - Using "Sentence" Option.
Posted: Thu May 29, 2025 4:06 pm
by dunbarx
Richmond.
I was making a point, not building the OP's project. So:
Code: Select all
on rawKeyUp tkey
if char - 3 to - 2 of me is ". " or the length of me = 1 then
put toUpper(numToChar(tkey)) into the last char of me
end if
end rawKeyUp
Thinking along those lines, one might also allow two or more spaces after the period. And what happens after a hard return? That sort of thing.
And any thoughts on the fact that I can no longer trap "keyUp"?
Craig
Re: Android Keyboard - Using "Sentence" Option.
Posted: Thu May 29, 2025 4:17 pm
by richmond62
And any thoughts on the fact that I can no longer trap "keyUp"?
No.
I am 'stuck' at 9.6.3.

Re: Android Keyboard - Using "Sentence" Option.
Posted: Thu May 29, 2025 4:37 pm
by stam
dunbarx wrote: ↑Thu May 29, 2025 4:06 pm
Richmond.
I was making a point, not building the OP's project. So:
Code: Select all
on rawKeyUp tkey
if char - 3 to - 2 of me is ". " or the length of me = 1 then
put toUpper(numToChar(tkey)) into the last char of me
end if
end rawKeyUp
And any thoughts on the fact that I can no longer trap "keyUp"?
Craig
mouseDown and mouseUp make sense, because if you're in mouseDown and the mouse moves out of the target area, mouseUp may have a different effect.
However, I don't understand why you would want to do this for pressing keys... it's not like a different action may be performed on keyUp.
But in any case, you need to pass the keyDown message to use the keyUp message. This makes your code work:
Code: Select all
on keydown
pass keydown
end keydown
on keyUp pKeyName
if char - 3 to - 2 of me is ". " or the length of me = 1 then
put toUpper(pKeyName) into the last char of me
end if
end keyUp
Re: Android Keyboard - Using "Sentence" Option.
Posted: Thu May 29, 2025 5:07 pm
by SWEdeAndy
Googie85 wrote: ↑Thu May 29, 2025 8:08 am
I have in the past viewed a way to set the Android keyboard to a "Sentence" option. Essentially when a key is pressed, the character will automatically set the case to uppercase. I have searched the dictionary for "Keyboard" but can't seem to find the information I need.
Search for autoCapitalizationType in the dictionary.
It's a property of the native android field widget. It seems the widget must be loaded for the entry to show up in the Dictionary.
Code: Select all
set the autoCapitalizationType of widget "Android Field" to "sentences"
Re: Android Keyboard - Using "Sentence" Option.
Posted: Thu May 29, 2025 6:00 pm
by dunbarx
Stam.
But in any case, you need to pass the keyDown message to use the keyUp message.
If I do not have a keyDown handler at all, that message is automatically passed to the engine at every keypress. It never occurred to me that such a thing was (should be) necessary. Explicitly doing so in a handler should do nothing additional.
I tried it anyway; it does not work.
But if
you have a keyDown handler does it make keyUp work? And if you do not, it does not either? I don't understand this.
All my work is in the field script.
Craig
Re: Android Keyboard - Using "Sentence" Option.
Posted: Thu May 29, 2025 6:21 pm
by dunbarx
Stam.
mouseDown and mouseUp make sense, because if you're in mouseDown and the mouse moves out of the target area, mouseUp may have a different effect.
However, I don't understand why you would want to do this for pressing keys... it's not like a different action may be performed on keyUp.
Yes, the mouse can change its environment between mouseDown and mouseUp. That is the reason behind "mouseRelease", to always remember the mouseDown target.
But it is not I who is concerned with pressing keys, it is the OP. I am not even sure I answered his needs.
Googie85?
My first handler was with "keyUp". But when that failed to even respond I went to "rawKeyUp" along with the deprecated "numTo"Char" function.
Craig
Re: Android Keyboard - Using "Sentence" Option.
Posted: Thu May 29, 2025 8:27 pm
by dunbarx
Richmond.
I am 'stuck' at 9.6.3.)
Does that matter? It might, if this is a regression, though I doubt it.
Nobody seems upset at this, so I think I will start a new thread...
Craig
Re: Android Keyboard - Using "Sentence" Option.
Posted: Fri May 30, 2025 4:11 pm
by jacque
This isn't a LC thing, it's a keyboard setting. Which keyboard are you using? I use SwiftKey, and the option is in the keyboard settings. Are you using the native Google keyboard?