how i can have one date picker in iOS and Android?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

how i can have one date picker in iOS and Android?

Post by aebki » Sat Jan 24, 2015 9:57 pm

Hi,

I am trying to put one date picker...But i feel lost! :-(
It should be one object date picker to can drag it to my card?
Anyway, as i didn't find nothing and as in the lesson was not explained to drag any object i copied the code but it didn't work...:-(
I had one error with one handler...
This is the lesson i was following and where is the code i copied:

http://lessons.runrev.com/m/4069/l/3730 ... -on-mobile

And what i am waiting to see in my card is what i attached in the image.

Regards.
Attachments
DatePicker.png

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

Re: how i can have one date picker in iOS and Android?

Post by Dixie » Mon Jan 26, 2015 7:56 am

Hi...

The datePicker will only appear in your stack if it is running in the simulator or on a device... I have attached a stack that displays the datepicker on opening for you... The lesson that you were reading is the correct one to understand the datePicker... There is no 'datePicker' object that you can drag from the tool palette...
Attachments
datePick.livecode.zip
(1.75 KiB) Downloaded 176 times

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: how i can have one date picker in iOS and Android?

Post by aebki » Mon Jan 26, 2015 11:53 am

Hi Dixie,

Thanks for your answer...:-)

I tried what you attached me in my iPad and it is working fine! :-)

My only doubt, is that if the picker can be as the image i attached in my last post ( the same one as the image in the lesson i saw ) or if it will be only as the image i attached in this post?

Because in the dictionary i didn't see the option to change it and make it 'more pretty'...:-(

Regards.
Attachments
DatePicker2.png
DatePicker2.png (26.4 KiB) Viewed 6721 times

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: how i can have one date picker in iOS and Android?

Post by Klaus » Mon Jan 26, 2015 3:23 pm

Hi aebki,

what you experience here is the cooperation between LC and the underlying OS!
LC does NOT create windows for its stacks, that's why e.g. Mac and Windows windows :D look different.
Same for almost any other controls like fields, scrollbars, buttons etc.

What you see here is this:
Obviously the lesson with the screenshot has been made with iOS < 8, so it looked a bit more colorful
than what you are seeing on your device with iOS >= 8, so complain at Apple for the current iOS look :D

P.S.
In case this is not clear enough: you cannot change this behavior!


Best

Klaus

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: how i can have one date picker in iOS and Android?

Post by aebki » Mon Jan 26, 2015 3:31 pm

Hi Klaus,

Thanks for your answer...:-)

Ok so i will complain to apple...:-)

I didn't imagine that they could do it 'less pretty' in one newer version...:-(

Regards.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: how i can have one date picker in iOS and Android?

Post by Klaus » Mon Jan 26, 2015 5:38 pm

Hi aebki,

beauty lies in the eye of the beholder!
And Apple's beholder is Jonathan Ives at the moment :D


Best

Klaus

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: how i can have one date picker in iOS and Android?

Post by aebki » Mon Jan 26, 2015 11:57 pm

:-) :-)

Regards.

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: how i can have one date picker in iOS and Android?

Post by aebki » Tue Jan 27, 2015 10:55 am

Hi,

another doubts about the date picker...:-)

How can i change the location of this object?

I tried with this line in the code, but it is not doing nothing...:-(

Code: Select all

      set the loc of iphonePickDate to 250 & comma & 450
So, this all the code:

Code: Select all

on mouseUp
   if environment() = "mobile" then
      iphonePickDate "date"
      set the loc of iphonePickDate to 250 & comma & 450
      if the result <> "cancel" then
         put the result into red
         put red into line 1 of fld 1
         convert red to seconds
         put red into line 2 of fld 1
         convert red to long date
         put red into line 3 of fld 1
      end if
   end if
end mouseUp
I need to locate the picker, because i will need to show two pickers ( one with date, and another one only to choose one value) and both they should appear when i open the card and i one precise place...
And even to make it appear in "on openCard" or "on openStack" is not working...:-( Only with one "on mouseUp"...

Is it normal? Because in the dictionary it was not written that is restricted only to "on mouseUp"...

So, i don't know how, but i thnk it should be possible to locate the date picker where you want and maybe too call it from one "on openCard"...

Thanks in advance!

Regards.

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

Re: how i can have one date picker in iOS and Android?

Post by Dixie » Tue Jan 27, 2015 11:12 am

You can only display one 'date picker' at a time...:-(
You can get the datePicker to display from openCard...

Code: Select all

on openCard
   if environment() = "mobile" then
      send "showDatePicker" to this card in 100 millisecs
   end if
end openCard

on showDatePicker
   iphonePickDate "date"
end showDatePicker

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: how i can have one date picker in iOS and Android?

Post by aebki » Tue Jan 27, 2015 1:51 pm

Hi Dixie,

Thanks for your answer...:-)

Ok, so i will do it in another way as i can't show two 'date pickers' in the same time...

Thanks to show me how to do it from one 'openCard'...:-)

And about the location of this 'date picker'... is it possible to choose where to locate it?

Code: Select all

set the loc of iphonePickDate to 250 & comma & 450
Regards.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: how i can have one date picker in iOS and Android?

Post by Klaus » Tue Jan 27, 2015 1:55 pm

Hi aebki,
set the loc of iphonePickDate to 250 & comma & 450
"iPhonePickDate" is a COMMAND, not an abject, so you cannot set its loc!

See it (and iPhonePickPhoto etc...) as a modal dialog like ASK and ANSWER,
there can only be ONE at a time on the screen.

Hint:
...
put the result into red
...
Be careful with your variable names!
RED is actually a reserved word (= the colorname!) so to avoid possible inconveniences, you should use another name.
Every new version of the engine is less forgiving that the previous one!


Best

Klaus

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

Re: how i can have one date picker in iOS and Android?

Post by Dixie » Tue Jan 27, 2015 3:20 pm

Oops... the name of the variable 'red' is my fault... :oops: not aebki's... I often just use what comes into my head when writing snippets.. :D :D

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: how i can have one date picker in iOS and Android?

Post by Klaus » Tue Jan 27, 2015 3:28 pm

Sheesh... :D

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: how i can have one date picker in iOS and Android?

Post by aebki » Tue Jan 27, 2015 4:45 pm

Hi,

Thanks for the answers! :-)

So yes, i saw that was not one object...:-)

What i could see, even if we can't loc the date picker is that is appearing always near the button who called it...
So i am wondering if i can wrote the code in the script of one button and make it invisible and then execute the code of this button without to press on it ( directly in the openCard...
Is it possible to call the script of one button without press the button???

Ok, i will change the red variable...:-)

Regards.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: how i can have one date picker in iOS and Android?

Post by Klaus » Tue Jan 27, 2015 4:57 pm

Hi aebki,
aebki wrote:Is it possible to call the script of one button without press the button???
sure, you can always:
...
send "mouseup" to btn "whatever"
...
It might be more effective to create a handler in the card or stack script
and call this from the button and/or from everywhere else! Know what I mean?


Best

Klaus

Post Reply

Return to “iOS Deployment”