mobilepick
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
mobilepick
Hi, updating some code from 5.5 to 7.1 and running into a bit of a problem with iPhonePickDate. In particular, this line does not appear to do anything anymore.
iPhonePickDate "date",defaultdate,,,,"canceldone"
Has it been replaced? I did a quick check of the dictionary and found neither iPhonePickDate nor MobilePickDate listed. A check of the release notes for 7.1 Indy does not contain any discussion. I missed a few versions inbetween so possibly this has been discussed elsewhere.
I did find this Livecode lesson
http://runrev.screenstepslive.com/s/352 ... -on-mobile
But before I forge onwards, I was wondering if this is the extent of documentation on these commands?
Thanks
Mark
iPhonePickDate "date",defaultdate,,,,"canceldone"
Has it been replaced? I did a quick check of the dictionary and found neither iPhonePickDate nor MobilePickDate listed. A check of the release notes for 7.1 Indy does not contain any discussion. I missed a few versions inbetween so possibly this has been discussed elsewhere.
I did find this Livecode lesson
http://runrev.screenstepslive.com/s/352 ... -on-mobile
But before I forge onwards, I was wondering if this is the extent of documentation on these commands?
Thanks
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
Re: mobilepick
Hi Mark,
not sure when this happened, but they obviously replaced all "iphonexxxx" commands to "mobilexxxx".
But I see "mobilepickdate" in the dictionary in LC 7.1.1!
Best
Klaus
not sure when this happened, but they obviously replaced all "iphonexxxx" commands to "mobilexxxx".
But I see "mobilepickdate" in the dictionary in LC 7.1.1!
Best
Klaus
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
Re: mobilepick
They didn't replace iPhoneDatePick you can use either one and they both work. I tend to use mobile so I don't get hicups with Android.
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: mobilepick
iphonePickDate still works on iOS... as in..
I use this to choose a date of birth... the maximum limit being today's date
Code: Select all
on mouseUp
iphonePickDate "date",0 ,0 , the seconds,1,"Cancel"
put the result into theDate
convert theDate to long date
answer theDate
end mouseUp
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
Re: mobilepick
Thanks everyone. Turns out my dictionary was on "Library" not "All" which is why I was not seeing iPhonePickDate or MobilePickDate. But that leaves me with another problem. Code that worked fine in 5.5 is not working in 7.1 (or 7.1.1) and I am not sure why. I should point out that the version of iOS has been upgraded as well and they DID change the way they handle specifying dates in the iOS settings. I don't remember how it was before, but with the current version there is a new Time Zone Override and before it was something else (and setup differently). So, as such I have too potential issue to debug... potentially one in LC, potentially one in iOS.
Long story short, this code used to invoke the pick wheel for dates every time and no longer does. I've attached a screen shot so you can see what it does (reports an error in the field "invalid date") and it never did that before. The data it is pulling is from the upper right hand corner (that is the date_selected field) and whatever was read from there before was always interpreted as a valid date, and now it is not.
Can anyone see a reason why? Thanks
Long story short, this code used to invoke the pick wheel for dates every time and no longer does. I've attached a screen shot so you can see what it does (reports an error in the field "invalid date") and it never did that before. The data it is pulling is from the upper right hand corner (that is the date_selected field) and whatever was read from there before was always interpreted as a valid date, and now it is not.
Can anyone see a reason why? Thanks
Code: Select all
on openfield
if the environment is "mobile" then
if edc is empty then
put date_selected into defaultdate
convert defaultdate from long system date to seconds
else
put fld "edc" into defaultdate
convert defaultdate from system date to seconds
end if
iPhonePickDate "date",defaultdate,,,,"canceldone"
put the result into temp
if temp <> "cancel" then
set the forecolor of me to black
convert temp to system date -- from seconds does not appear to work here
put temp into me
else
-- put empty into me
end if
closefield
end if
end openfield
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
Re: mobilepick
This works in every LC version 6, 7 and 8. Maybe your error comes from foreColor... should be foregroundColor.
Code: Select all
on mouseUp
local tFldName, tPicked
if environment() is not "mobile" then exit mouseUp
put the short name of the owner of the target into tFldName
put fld tFldName of me into tSelected
if tSelected is a date then
convert tSelected to seconds
else
put empty into tSelected
end if
mobilePickDate "Date",tSelected,,,,"CancelDone"
put the result into tPicked
if tPicked is "Cancel" then
set the foregroundColor of fld tFldName of me to 150,150,150
put tFldName into fld tFldName of me
set the uTextChanged of this cd to true
else
set the foregroundColor of fld tFldName of me to 0,0,0
put formattedDate(tPicked) into fld tFldName of me
set the uTextChanged of this cd to true
end if
focus nothing
end mouseUp
Code: Select all
function formattedDate pDate
if pDate is empty or pDate is not a date then put the short english date into pDate
convert pDate from short english date to dateItems
put item 3 of pDate into theDay
put item 2 of pDate into theMonth
put item 1 of pDate into theYear
put theMonth & "/" & theDay & "/" & theYear into tFormattedDate
return tFormattedDate
end formattedDate
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
Re: mobilepick
Thanks everyone, I did get it working. I feel like I owe you an explanation, although to be honest I am not really sure what the solution was exactly. I do know it was not code. The code is the same and the pick wheel now appears. It appears it was due to some odd combination of external factors. I have several versions of LC (7.1 and 7.1.1) and Xcode (6.4 and 7.1) on my system. When I use LC 7.1 it wants one config of SDK and Xcode and when I use 7.1.1 it wants a different config. This has been a problem for me in the past, typically triggered by an upgrade to iOS and then nothing works for awhile until I (accidentally it appears) discover the right combination of tools to use. In this case I am now using LC 7.1.1, Xcode 7.1 and whatever SDK that is and things are working.
Thanks for all your help (and patience - it can be frustrating sometimes tracking down elusive "ghosts in the machine")
Mark
Thanks for all your help (and patience - it can be frustrating sometimes tracking down elusive "ghosts in the machine")
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS