I have a bug when typing 0,35 or 0.35 in fields at Android phones

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
UrosDobricic
Posts: 23
Joined: Wed Sep 25, 2019 6:33 pm

I have a bug when typing 0,35 or 0.35 in fields at Android phones

Post by UrosDobricic » Tue Oct 08, 2019 10:02 pm

Hi,

i dont know why this is happening, but i have a bug in my app on android phones.
When the user types 0,35 or 0.35 the number is doubled and then it appears like 0,30,35.

Maybe someone is going to find the error, i did not.
I added my app here, so you can see what is happening.
In the IDE it works fine, it is just happening on my phone.

Thanks for helping me out!

Uros
Attachments
angelschnur.livecode.zip
(6.95 KiB) Downloaded 230 times

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: I have a bug when typing 0,35 or 0.35 in fields at Android phones

Post by bangkok » Wed Oct 09, 2019 3:10 am

-Which field shows this weird behavior ? You have 6 fields on your card.

-be more precise : when the user select field "kapmm", he types "0.35", then what is shown exactly in the field ?

-no need to put the handler preOpenStack in your button script ! (it's already into your stack script)

-why you set traversalOn false and then on ? On the group ?
just do :

Code: Select all

on opencard 
select the text of field "kapmm" 
end opencard
-your choice (the user types directly into the field) does not seem efficient from my point of view.
You have no control on what the user will input...
I would rather lock each field... and do something like that :

Code: Select all

on mouseup
ask "Data :"
if the result is "cancel" then exit to top
put it into tData
replace "," with "." in tData --- classic mistake... In Europe we use "comma"... But Livecode needs "point"

replace " " with "" in tData 

if tData is not a number then
answer "Number only please !"
exit to top
end if
put tData into me
end mouseup

UrosDobricic
Posts: 23
Joined: Wed Sep 25, 2019 6:33 pm

Re: I have a bug when typing 0,35 or 0.35 in fields at Android phones

Post by UrosDobricic » Wed Oct 09, 2019 11:27 am

Hi bangkok,

this problem appears on every field the user types in. ( On each of the 6 fields)
If the user for example types 0,35 or 0.35 then the app doubles the numbers. So it appears like 0.30.35

With the traversalOn i managed to undo the autofocus on field´s when the app starts.

But yes, that might be a solution with the ask method. I will try it and then i will write my results.
Thank you very much!!!

Best wishes,

Uros
Last edited by UrosDobricic on Wed Oct 09, 2019 12:26 pm, edited 1 time in total.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: I have a bug when typing 0,35 or 0.35 in fields at Android phones

Post by Klaus » Wed Oct 09, 2019 11:45 am

Hi Uros,

you do not check for COMMA or DOT in that stack at all!?
And the "preopenstack" handler in the "mousedown" handler of the button does not make sense.

And please supply some example data for that stack to see what is happening.
Not being a fisherman I have no idea what values the fields are exspecting. :D


Best

Klaus

UrosDobricic
Posts: 23
Joined: Wed Sep 25, 2019 6:33 pm

Re: I have a bug when typing 0,35 or 0.35 in fields at Android phones

Post by UrosDobricic » Wed Oct 09, 2019 11:52 am

Hi Klaus,

For example some data in the screenshot.

I did that with

replace "," with "." but i deleted it because i was searching for the error that appears on android.

I think the solution with ask will do it, i will try it at the evening today.

Best wishes,

Uros
Attachments
app.PNG

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: I have a bug when typing 0,35 or 0.35 in fields at Android phones

Post by Klaus » Wed Oct 09, 2019 11:58 am

Ah, I see.

So although it works fine in the IDE (without COMMA) but fails on Android with or without COMMA. Is that correct?
Then I would consider this a bug!

But please also post your WITH COMMA script, just to be sure!

UrosDobricic
Posts: 23
Joined: Wed Sep 25, 2019 6:33 pm

Re: I have a bug when typing 0,35 or 0.35 in fields at Android phones

Post by UrosDobricic » Wed Oct 09, 2019 12:06 pm

Hi Klaus,

yes that is what I wanted to say. With COMMA or without COMMA it goes crazy :D

I added also a Screenshot from my Phone, so you can see what i mean. This is Happening with or without COMMA.
I think this is a Bug.

I will upload at the evening the version with comma, so you can see this version also.

Regards,

Uros
Attachments
Screenshot_20191009_133114_com.urosdobricic.angelschnurrechner.jpg
Screenshot_20191009_132530_com.urosdobricic.angelschnurrechner.jpg

UrosDobricic
Posts: 23
Joined: Wed Sep 25, 2019 6:33 pm

Re: I have a bug when typing 0,35 or 0.35 in fields at Android phones

Post by UrosDobricic » Wed Oct 09, 2019 6:20 pm

hi guys,

as I promised, I attached the old file with the without COMMA Script.

Regards,

Uros
Attachments
angelschnur.livecode.zip
(7.09 KiB) Downloaded 194 times

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: I have a bug when typing 0,35 or 0.35 in fields at Android phones

Post by Klaus » Wed Oct 09, 2019 6:29 pm

Hi Uros,

hm, with the values in your screenshot I get this when entering values WITH comma 0,35:
---------------------------------------------------------------------------
Die benötigte Füllschnurlänge in Meter beträgt : 1224962,5
Auf die Rolle passen in Meter insgesamt : 4900000
--------------------------------------------------------------------------
Seems a bit MUCH to me. 8)

But looks OK, if I use the same values with DOT -> 0.35
----------------------------------------------------------------------
Die benötigte Füllschnurlänge in Meter beträgt : 85
Auf die Rolle passen in Meter insgesamt : 490
---------------------------------------------------------------------
Will take a deeper look later...


Best

Klaus

UrosDobricic
Posts: 23
Joined: Wed Sep 25, 2019 6:33 pm

Re: I have a bug when typing 0,35 or 0.35 in fields at Android phones

Post by UrosDobricic » Wed Oct 09, 2019 6:43 pm

Hi Klaus,

yes, that is the problem. I calculates wrong. And in Android it doubles the numbers.
That is the bug i have.The values with the DOT are fine, just the values with the COMMA are wrong.
You saw what is happening at Android, i uploaded the screenshots.

Thanks a lot for helping me out!

Uros

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7214
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: I have a bug when typing 0,35 or 0.35 in fields at Android phones

Post by jacque » Wed Oct 09, 2019 6:45 pm

The were some problems using LC fields on mobile, and sometimes these included repetitions of user input among other things. Most of the problems have been resolved in the latest versions of LC but the best way to avoid them entirely is to use native mobile controls instead of LC fields.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: I have a bug when typing 0,35 or 0.35 in fields at Android phones

Post by Klaus » Wed Oct 09, 2019 7:01 pm

Hi Uros,

it works correctly if I first convert ALL neccessary field to -> OHNE_KOMMA and THEN do all the calculations.
I think this is the way to go!

Code: Select all

local zwischenrechnung,kapmm,hauptmm,hauptkvadrat,kapkvadrat,schlagmm,schlagkvadrat

on mouseDown
   put ohne_komma(field "kapmm") into kapmm
   put kapmm^2 into kapkvadrat
   put ohne_komma(field "hauptmm") into hauptmm
   put hauptmm^2 into hauptkvadrat
   put kapkvadrat / hauptkvadrat into faktor
   put faktor * field "kapm" into zwischenrechnung
   put mit_komma(round(zwischenrechnung,2)) into field "hauptm"
end mouseDown

on mouseUp
   put ohne_komma(field "schlagmm") into schlagmm
   put ohne_komma(field "schlagm") into schlagm
   put schlagmm^2 into schlagkvadrat
   put hauptkvadrat / schlagkvadrat into faktor2
   put (schlagm-zwischenrechnung)*faktor2 into fuellschnurm
   put "Die benötigte Füllschnurlänge in Meter beträgt : " & mit_komma(round(fuellschnurm*-1,2)) into field antwort
   put "Auf die Rolle passen in Meter insgesamt : "& the value of field "hauptm" into line 2 of field antwort
   
   if field "Positive Korrektur" is not empty then
      put the value of field "Positive Korrektur" into poskor
      put fuellschnurm*((poskor/100)+1) into poskorergebnis
      put "Der korrigierte Wert beträgt : "& (round(poskorergebnis *-1,2)) into line 3 of field "antwort"
   end if
   
   if field "Negative Korrektur" is not empty then
      put the value of field "Negative Korrektur" into negkor
      put ((100-negkor)/100) into negkorkor
      put fuellschnurm*(negkorkor) into negkorergebnis
      put "Der korrigierte Wert beträgt : "& (round(negkorergebnis*-1,2)) into line 3 of field "antwort"
   end if
end mouseUp
Best

Klaus

UrosDobricic
Posts: 23
Joined: Wed Sep 25, 2019 6:33 pm

Re: I have a bug when typing 0,35 or 0.35 in fields at Android phones

Post by UrosDobricic » Wed Oct 09, 2019 7:40 pm

Hi Klaus,

the calculation works fine with your method.
But the bug is still there.

@jacque:
I'm using now the ask method, and with this method it works perfectly.
I hope LC is going to fix this bug.
I have the newest LC 9.5 Version, so this is not the problem i think.

Regards,

Uros

Post Reply

Return to “Android Deployment”