handle cancel button iphonePickDate

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
HengeDK
Posts: 14
Joined: Wed Aug 29, 2012 9:09 pm

handle cancel button iphonePickDate

Post by HengeDK » Wed Oct 10, 2012 7:18 pm

how can you handle the cancel button in iphonePickDate dialog

if I press the cancel button I receive "10/10/70 :01.00" back
can I be sure that all users will receive this back ?

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: handle cancel button iphonePickDate

Post by Klaus » Wed Oct 10, 2012 7:23 pm

We have a special iOS forum, please use this for all iOS related question (beginner or not).
Will move this post now (just like your previous one 8) )

HengeDK
Posts: 14
Joined: Wed Aug 29, 2012 9:09 pm

Re: handle cancel button iphonePickDate

Post by HengeDK » Wed Oct 10, 2012 7:29 pm

will do

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4168
Joined: Sun Jan 07, 2007 9:12 pm

Re: handle cancel button iphonePickDate

Post by bn » Wed Oct 10, 2012 7:52 pm

Hi,

the documentation is a bit ambiguous on this:

at one place it says that the return value contains 0 if the user canceled, at another place that the return value is "cancel" if the user canceled.

So best would be if you test the result for "cancel" and also for "0" to catch a cancel event before converting to date && time.
I would expect that you get 01/01/70 :01:00
This is because I guess your computer is set to a time zone UTC +1, hence 01:00 instead of 00:00 which would show up if you would set your computer time zone to Greenwich Mean Time = UTC. This is not taking into account Daylight saving time.
Kind regards
Bernd

HengeDK
Posts: 14
Joined: Wed Aug 29, 2012 9:09 pm

Re: handle cancel button iphonePickDate

Post by HengeDK » Wed Oct 10, 2012 7:55 pm

Hi Bernd

Thanks for your help

both "0" and "cancel" is a no go

any other ideas ;-)

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4168
Joined: Sun Jan 07, 2007 9:12 pm

Re: handle cancel button iphonePickDate

Post by bn » Wed Oct 10, 2012 8:22 pm

I would make a field and put the result into the field. Then you would know what the result contains when you do different actions.

Kind regards
Bernd

HengeDK
Posts: 14
Joined: Wed Aug 29, 2012 9:09 pm

Re: handle cancel button iphonePickDate

Post by HengeDK » Wed Oct 10, 2012 8:35 pm

Hi Bernd

thanks for your help !!

I did and I get 01/01/70 :01:00 every time I press cancel

My problem is I can't check for all countries with different timezones

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4168
Joined: Sun Jan 07, 2007 9:12 pm

Re: handle cancel button iphonePickDate

Post by bn » Wed Oct 10, 2012 9:04 pm

If you convert the result to seconds you get 0, which is the begin of the unix epoch. You don't have to worry about time zones. It will always be zero.

but beware: for the ipad you have to explicitly set the cancel/done option. Otherwise a click outside of the pickWheel without selection will return the current date/time.

Kind regards
Bernd

HengeDK
Posts: 14
Joined: Wed Aug 29, 2012 9:09 pm

Re: handle cancel button iphonePickDate

Post by HengeDK » Wed Oct 10, 2012 9:32 pm

Hi Bernd

You are the man !!

thanks a lot !

Post Reply