Page 1 of 1

Getting Contents Of A Native Android Field Widget

Posted: Thu Feb 10, 2022 11:15 am
by Googie85
Hi Guys!!

I am having problems with the following code:

Code: Select all

on keyDown theKey 
   put the text of widget "ONE" into blah
   put the number of chars in blah into blah
   answer blah
end keyDown
The above code is under the "ONE" widget. What am I doing wrong??

Many Thanks,

Googie.

Re: Getting Contents Of A Native Android Widget

Posted: Thu Feb 10, 2022 11:24 am
by richmond62
Dunno; this worked:

Code: Select all

on keyDown KKK
   put the text of widget "ANF" into XYZ
   put the number of chars in XYZ into ABC
   answer ABC
end keyDown
Possibly using blah all the time. :D

Re: Getting Contents Of A Native Android Field Widget

Posted: Thu Feb 10, 2022 11:34 am
by Googie85
Thanks for your reply, it didn't work.

Anyone have any more ideas??

Many Thanks,

Googie.

Re: Getting Contents Of A Native Android Field Widget

Posted: Thu Feb 10, 2022 11:38 am
by richmond62
It worked on MacOS.

Re: Getting Contents Of A Native Android Field Widget

Posted: Thu Feb 10, 2022 11:46 am
by Googie85
Thanks for your help!!!!

I am using an Android Native Field. Maybe it might not work on macOS...

Thanks, Richmond!!!!

Re: Getting Contents Of A Native Android Field Widget

Posted: Thu Feb 10, 2022 12:09 pm
by Klaus
Maybe KEYDOWN etc. do not work with Android native fields?
Unfortunately the Dictionary gives no hint.

Try the script with an "ordinary" LC text field and see if that works.
If yes, then it does not work this way with a native field.

Re: Getting Contents Of A Native Android Field Widget

Posted: Thu Feb 10, 2022 12:13 pm
by Googie85
Thanks Klause!!

I was hoping to use the Native Field to disable the Auto Correct in the field. I will keep looking for a solution...

Thanks,

Googie.

Re: Getting Contents Of A Native Android Field Widget

Posted: Thu Feb 10, 2022 12:32 pm
by Klaus
KLAUS, my name is KLAUS, no E at the end!

Re: Getting Contents Of A Native Android Field Widget

Posted: Thu Feb 10, 2022 12:33 pm
by Googie85
Loser... Why be rude...

Re: Getting Contents Of A Native Android Field Widget

Posted: Thu Feb 10, 2022 12:44 pm
by Klaus
Mimimi?

Emphasizing something with capital letters is not being rude!
And thank you for the "loser", much appreciated!

Re: Getting Contents Of A Native Android Field Widget

Posted: Thu Feb 10, 2022 2:07 pm
by richmond62
I tried my code with an Android native field widget
on MacOS.

What becomes clear is that development on a
desktop machine for Android is beset with
lots of traps.

Oh, Googie, as an expert at offending people,
using words like 'loser' round here will only
make you lose, no one else. So, please stop
doing that.

Re: Getting Contents Of A Native Android Field Widget

Posted: Thu Feb 10, 2022 7:16 pm
by jacque
KeyDown isn't supported in the native Android field. Use "on textChanged" instead.

You can see all the supported commands and functions in the dictionary if you look up "Android native field".

Re: Getting Contents Of A Native Android Field Widget

Posted: Thu Feb 10, 2022 7:23 pm
by jacque
richmond62 wrote:
Thu Feb 10, 2022 2:07 pm
I tried my code with an Android native field widget
on MacOS.

What becomes clear is that development on a
desktop machine for Android is beset with
lots of traps.
Native controls don't work well unless you're in the OS that supports them. You can't test an Android or iOS widget on a computer. There aren't any traps per se, just differences among operating systems.

Re: Getting Contents Of A Native Android Field Widget

Posted: Thu Feb 10, 2022 8:11 pm
by richmond62
Native controls don't work well unless you're in the OS that supports them.
Thank you very much for explaining that explicitly.

Re: Getting Contents Of A Native Android Field Widget

Posted: Fri Feb 11, 2022 7:44 pm
by jacque
I suppose the only "trap" is the generic one where you have to indulge in the behavioral loop that requires a code change, a recompile, a test, repeat, over and over until you get it right. It's tedious when writing for mobile but I don't see any way around it. The instructions the engine requires are only available on the supported OS.