If then.. else on Mobile (Android)
Moderators: LCNeil, heatherlaine, kevinmiller, elanorb
-
- Posts: 192
- Joined: Tue Mar 11, 2014 12:57 pm
If then.. else on Mobile (Android)
The following code works on a Windows button and clears data from a datagrid:
on mouseUp
answer question "Clear Old Data?" with "Yes" or "No"
if it is "Yes" then set the dgData of group "dgBaseRec" to empty
else end if
end mouseUp
but not on Android. Anyone have a solution?
on mouseUp
answer question "Clear Old Data?" with "Yes" or "No"
if it is "Yes" then set the dgData of group "dgBaseRec" to empty
else end if
end mouseUp
but not on Android. Anyone have a solution?
Re: If then.. else on Mobile (Android)
Hi,
It is strange that it would work on Windows but not on Android. Normally, elementary code like this works on all platforms. Your code looks a little uncommon, though. Why don't you try:
without "else end if"?
Kind regards,
Mark
It is strange that it would work on Windows but not on Android. Normally, elementary code like this works on all platforms. Your code looks a little uncommon, though. Why don't you try:
Code: Select all
on mouseUp
answer question "Clear Old Data?" with "Yes" or "No"
if it is "Yes" then set the dgData of group "dgBaseRec" to empty
end mouseUp
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Posts: 192
- Joined: Tue Mar 11, 2014 12:57 pm
Re: If then.. else on Mobile (Android)
No I tried that first of all. It's easy to set up on a button to clear the datagrid and that works. But I wanted a way to cancel the clear data if you pressed the button by mistake.
-
- Posts: 192
- Joined: Tue Mar 11, 2014 12:57 pm
Re: If then.. else on Mobile (Android)
Now trying:
answer question "Clear Old Data?" with "Yes" or "No"
switch
case i is "Yes"
set the dgData of group "dgBaseRec" to empty
break
case i is "No"
beep
break
end switch
still not working...
answer question "Clear Old Data?" with "Yes" or "No"
switch
case i is "Yes"
set the dgData of group "dgBaseRec" to empty
break
case i is "No"
beep
break
end switch
still not working...
-
- Livecode Opensource Backer
- Posts: 1336
- Joined: Sun Jul 12, 2009 10:53 am
- Location: Bordeaux, France
Re: If then.. else on Mobile (Android)
The result from the answer dialog is contained in 'it'
Code: Select all
on mouseUp
answer "Clear Old Data" with "Yes" or "No"
switch it
case "Yes"
--do what you need to do
break
case "No"
--do something else
break
end switch
end mouseUp
Re: If then.. else on Mobile (Android)
Hi All,
Dixie is correct with his script above, and placing his script in a sample stack with a datagrid works as expected. Please find this stack attached below-
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
LiveCode – Realize fast, compile-free coding
--
Dixie is correct with his script above, and placing his script in a sample stack with a datagrid works as expected. Please find this stack attached below-
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
LiveCode – Realize fast, compile-free coding
--
-
- Posts: 192
- Joined: Tue Mar 11, 2014 12:57 pm
Re: If then.. else on Mobile (Android)
I am only able to get this to work with standard Livecode buttons not Mobgui ones tested via Android phone.
Re: If then.. else on Mobile (Android)
HI NewtronSols,
Please post a sample stack and it will allow us to investigate what could be causing the issue
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
Please post a sample stack and it will allow us to investigate what could be causing the issue
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
-
- Posts: 192
- Joined: Tue Mar 11, 2014 12:57 pm
Re: If then.. else on Mobile (Android)
You have the code already it is as above. It just doesn't work on Android using mobgui buttons. You can copy paste from the code above to a mobgui button. But you need to use Livecode on a windows 7 PC then build for mobile Android to replicate.
I've also noticed another trivial - ish issue - I believe the code output from Livecode needs to include a zipalign feature. I've noticed issues that disappear when the app is zipaligned. You could say it's like visual 'juddering'. I suspect the phone may be recovering from some sort of error because the files aren't zipalign'd. Otherwise why do apk files have to be zipalign'd to be accepted by Google Play and for Android devices? I also didn't use Inner-activ for adverts as I witnessed it had severe problems and there is ONE product that is far easier/better to use that doesn't need code.
My demo project is on Google Play as: https://play.google.com/store/apps/deta ... m4.yourapp I wanted the 'clear all' to prompt before clearing. A test user asked for this.
My design is 'old school' as I haven't used the app2market template approach - because I had built a wireframe before Xmas that I wanted to implement. It's a bit of a patchwork of forum code etc.
It also has a few other issues I know about - like the View button has some code the same as the Back button on the 2nd card - for the visual effect - but suddenly stopped working one day. I also copied my Share button verbatim to the 2nd card & made all the variables global but it didn't work. Probably should have made it a background. But I'd have to start again. I also #'d out all the email attachment code as that doesn't work on Android.
But I'm waiting for 'real' user [unemployed people] feedback to fix any problems they have.
I've also noticed another trivial - ish issue - I believe the code output from Livecode needs to include a zipalign feature. I've noticed issues that disappear when the app is zipaligned. You could say it's like visual 'juddering'. I suspect the phone may be recovering from some sort of error because the files aren't zipalign'd. Otherwise why do apk files have to be zipalign'd to be accepted by Google Play and for Android devices? I also didn't use Inner-activ for adverts as I witnessed it had severe problems and there is ONE product that is far easier/better to use that doesn't need code.
My demo project is on Google Play as: https://play.google.com/store/apps/deta ... m4.yourapp I wanted the 'clear all' to prompt before clearing. A test user asked for this.
My design is 'old school' as I haven't used the app2market template approach - because I had built a wireframe before Xmas that I wanted to implement. It's a bit of a patchwork of forum code etc.
It also has a few other issues I know about - like the View button has some code the same as the Back button on the 2nd card - for the visual effect - but suddenly stopped working one day. I also copied my Share button verbatim to the 2nd card & made all the variables global but it didn't work. Probably should have made it a background. But I'd have to start again. I also #'d out all the email attachment code as that doesn't work on Android.
But I'm waiting for 'real' user [unemployed people] feedback to fix any problems they have.
Re: If then.. else on Mobile (Android)
Hi newtronsols,
Please find attached the datagrid example with a mobGui button. I have tested this on my Android device from a windows installation and the button works the same as a standard LiveCode button-
When you mention that your didnt use inner-active advertisements in LiveCode, do you mean that you are implemented an alternative system than inner-active? If so, it would be great if you could share your methods for the benefit of other coding school users.
In regards to zipalignment, this process is carried out automatically by LiveCode during the build process so there should be no need to do it manually. This could imply that there is a bug occurring during the build process for you which could be silently affecting other users. It would be great if you could file a bug report on this this as it will allow our Quality Control team to carry out investigations into the issue and if needed, implement a fix
http://quality.runrev.com
Thank you for providing a link to your application. Its always good to see what our users are creating. I believe the email attachment bug was resolved in version 6.6.0 of LiveCode so you may wish to look into re-implementing that feature.
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
Please find attached the datagrid example with a mobGui button. I have tested this on my Android device from a windows installation and the button works the same as a standard LiveCode button-
When you mention that your didnt use inner-active advertisements in LiveCode, do you mean that you are implemented an alternative system than inner-active? If so, it would be great if you could share your methods for the benefit of other coding school users.
In regards to zipalignment, this process is carried out automatically by LiveCode during the build process so there should be no need to do it manually. This could imply that there is a bug occurring during the build process for you which could be silently affecting other users. It would be great if you could file a bug report on this this as it will allow our Quality Control team to carry out investigations into the issue and if needed, implement a fix
http://quality.runrev.com
Thank you for providing a link to your application. Its always good to see what our users are creating. I believe the email attachment bug was resolved in version 6.6.0 of LiveCode so you may wish to look into re-implementing that feature.
Kind Regards,
Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——
-
- Posts: 192
- Joined: Tue Mar 11, 2014 12:57 pm
Re: If then.. else on Mobile (Android)
Thanks. I'll take a look at the attachment aspect again. I did try 6.6 but the instability/crashing made me switch back to 6.5.2. So I never got to test it.
The advertising service I used is: http://www.vserv.mobi/ they have an appwrapper - I simply fed in my 'jarsign'ed/zipalign'ed' apk and made my choices and out comes a wrapped apk with advertising/stat tracking. They also have a range of choices e.g. charity donations.
I went down the route of choosing 'not signed'/then signing with jarsigner.. But Google Rejected so I zipalign'ed. So it could be because I didn't sign via Livecode.
Another service I tried was http://droid-at-screen.ribomation.com/ which is a great way to project your final mobile app back onto a screen - e.g. to demo to clients etc.
The advertising service I used is: http://www.vserv.mobi/ they have an appwrapper - I simply fed in my 'jarsign'ed/zipalign'ed' apk and made my choices and out comes a wrapped apk with advertising/stat tracking. They also have a range of choices e.g. charity donations.
I went down the route of choosing 'not signed'/then signing with jarsigner.. But Google Rejected so I zipalign'ed. So it could be because I didn't sign via Livecode.
Another service I tried was http://droid-at-screen.ribomation.com/ which is a great way to project your final mobile app back onto a screen - e.g. to demo to clients etc.
Last edited by newtronsols on Mon Apr 07, 2014 12:40 pm, edited 1 time in total.
-
- Posts: 192
- Joined: Tue Mar 11, 2014 12:57 pm
Re: If then.. else on Mobile (Android)
Re: mobgui test: Yes this works:
# MobGUI Button Control
on mouseUp
answer "Clear Old Data" with "Yes" or "No"
switch it
case "Yes"
set the dgData of group 1 to empty
break
case "No"
break
end switch
end mouseUp
I was using Old mobgui approach {effectively}:
on touchEnd pId
mobGUIUntouch the long id of me
answer "Clear Old Data" with "Yes" or "No"
switch it
case "Yes"
set the dgData of group 1 to empty
break
case "No"
break
end switch
end touchEnd
I have tested with the oldmobgui design button and it works as well with this onmouseup approach.
# MobGUI Button Control
on mouseUp
answer "Clear Old Data" with "Yes" or "No"
switch it
case "Yes"
set the dgData of group 1 to empty
break
case "No"
break
end switch
end mouseUp
I was using Old mobgui approach {effectively}:
on touchEnd pId
mobGUIUntouch the long id of me
answer "Clear Old Data" with "Yes" or "No"
switch it
case "Yes"
set the dgData of group 1 to empty
break
case "No"
break
end switch
end touchEnd
I have tested with the oldmobgui design button and it works as well with this onmouseup approach.