Page 1 of 1

Ios date picker

Posted: Thu Sep 22, 2011 10:55 am
by terryhocw
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

Re: Ios date picker

Posted: Thu Sep 22, 2011 11:11 am
by Dixie
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

Re: Ios date picker

Posted: Thu Sep 22, 2011 12:21 pm
by Klaus
Hi Terry,

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


Best

Klaus

Re: Ios date picker

Posted: Thu Sep 22, 2011 2:53 pm
by terryhcw3
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

Re: Ios date picker

Posted: Thu Sep 22, 2011 2:58 pm
by Dixie
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

Re: Ios date picker

Posted: Thu Sep 22, 2011 3:13 pm
by Klaus
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

Re: Ios date picker

Posted: Sun Sep 25, 2011 4:40 am
by terryhcw3
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