Ios date picker

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
terryhocw
Posts: 4
Joined: Thu Sep 22, 2011 10:43 am

Ios date picker

Post by terryhocw » Thu Sep 22, 2011 10:55 am

Hi all,

I make a simple stack which use to test the IOS date picker. I put the following code into a button script

on mouseUp
local tDateResult
// launch the date picker
iphonePickDate "date"
// get the result
put the result into tDateResult
// check and display the result in the text field
if tDateResult is 0 then
put "No Selection Made" into field "DateField"
else
convert tDateResult from seconds to abbreviated date
put tDateResult into field "DateField"
end if
end mouseUp

When I run this stack, it return the following error
execution error at line 4 (Handler: can't find handler) near "iphonePickDate"

Am I missing something. Please advise

Regards

Terry Ho

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Ios date picker

Post by Dixie » Thu Sep 22, 2011 11:11 am

Hi Terry...

Very quickly as an example, this should work for you

Code: Select all

on mouseUp
   put the long date into dateVariable
   convert dateVariable to seconds
   
   put abs(dateVariable) into dateChosen
   iphonePickDate "dateTime", "dateChosen"
   put the result into fld 1
end mouseUp
be well

Dixie

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

Re: Ios date picker

Post by Klaus » Thu Sep 22, 2011 12:21 pm

Hi Terry,

"iphonePickDate" was introduced in LiveCode 4.6.4!
So my quick guess: Are you using this version? 8)


Best

Klaus

terryhcw3
Posts: 6
Joined: Wed Apr 13, 2011 2:13 pm

Re: Ios date picker

Post by terryhcw3 » Thu Sep 22, 2011 2:53 pm

Hi all,

I'm using 4.64 and the latest version.

Hi Dixie, You method does not work, it also has the same problem in the "iphonePickDate", which can not find the handler.

I think I must miss some library to call the IphonePickdate function.

Can anyone advise me what I'm missing.

Regards

Terry Ho

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Ios date picker

Post by Dixie » Thu Sep 22, 2011 2:58 pm

Terry...
Hi Dixie, You method does not work, it also has the same problem in the "iphonePickDate", which can not find the handler.
Mmm.. can't help then, as it works here

Dixie

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

Re: Ios date picker

Post by Klaus » Thu Sep 22, 2011 3:13 pm

Hi Terry,

I think I got it! :D

You are running the script in the IDE, right?
Unfortunately the desktop engine (the IDE) does not recognize iOS specific syntax!

So you need to check the environment:

Code: Select all

on mouseUp

   ## ONLY execute in iOS devide or simulator!
   if the environment <> "mobile" then
     exit mouseup
   end if
   put the long date into dateVariable
   convert dateVariable to seconds
   
   put abs(dateVariable) into dateChosen
   iphonePickDate "dateTime", "dateChosen"
   put the result into fld 1
end mouseUp
Yes, this is more than inconvenient and can only be tested on the real device or simulator,
but is the only way to go 8)


Best

Klaus

terryhcw3
Posts: 6
Joined: Wed Apr 13, 2011 2:13 pm

Re: Ios date picker

Post by terryhcw3 » Sun Sep 25, 2011 4:40 am

Hi Klaus

I think you hit the target. But I still can not run in IOS simulator in my Mac machine.

I think the problem is come from the Mac OS (Target).

Regards

Terry Ho

Post Reply