Date and Time picker?

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Contact:

Date and Time picker?

Post by malte » Thu Jul 11, 2013 11:20 am

Hi all,

it seems that mobilePickDate is only supported on iOS when using dateTime. What do you folks do on the droid if you need a date + time?

Best,

Malte

JacobS
Posts: 58
Joined: Mon Aug 20, 2012 8:41 pm

Re: Date and Time picker?

Post by JacobS » Mon Jul 15, 2013 9:44 pm

Hi Malte,

So far I have not found a very efficient way to choose both a date and time using mobilePickDate on Android. I have a kind of ridiculous work-around that I use on my Android app that has worked for me so far. Here's the code:

Code: Select all

local whatTime = 1
local t1
local t2

on chooseDate
   if whatTime is 1 then
      put empty into t1
      mobilePickDate
      if the result is not "cancel" then
         put the result into t1
         set the itemdelimiter to slash
         add 1 to item 2 of t1
      end if
      add 1 to whatTime
      send mouseDown to me in .01 sec
   else if whatTime is 2 then
      put empty into t2
      mobilePickDate "time"
      if the result is not "cancel" then
         put the result into t2
         split t2 by ":"
         if t2[2] contains "PM" then
            add 17 to t2[1]
            replace " PM" with empty in t2[2]
         else
            replace "12" with "0" in t2[1]
            add 5 to t2[1]
            replace " AM" with empty in t2[2]
         end if
         if t2[1] >= 24 then
            put (t2[1] mod 24) into t2[1]
         end if
         combine t2 by ":"
      end if
      add 1 to whatTime
      send mouseDown to me in .01 sec
   else
      set the text of me to (t1&&t2)
      put 1 into whatTime
   end if
end chooseDate
Picking hours using an Android doesn't work very well at all, and that's why I had to do the "add 17 to t2[1]" command, among others.
Here's a link to a forum post where some people have talked about this:
http://forums.runrev.com/viewtopic.php?f=7&t=12735

Good luck! If you find out a better way to pick date/time, please post it! I'm sure we're not the only 2 that need a better way to pick date/time.

-Jacob

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Contact:

Re: Date and Time picker?

Post by malte » Mon Sep 30, 2013 11:18 pm

Hi Jacob,

please excuse my late reply. I guess this smells like mimicing a control... I hope to get around to doing that at some point.

Cheers,

Malte

Post Reply