Page 1 of 3
how i can have one date picker in iOS and Android?
Posted: Sat Jan 24, 2015 9:57 pm
by aebki
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.
Re: how i can have one date picker in iOS and Android?
Posted: Mon Jan 26, 2015 7:56 am
by Dixie
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...
Re: how i can have one date picker in iOS and Android?
Posted: Mon Jan 26, 2015 11:53 am
by aebki
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.
Re: how i can have one date picker in iOS and Android?
Posted: Mon Jan 26, 2015 3:23 pm
by Klaus
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

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
P.S.
In case this is not clear enough: you cannot change this behavior!
Best
Klaus
Re: how i can have one date picker in iOS and Android?
Posted: Mon Jan 26, 2015 3:31 pm
by aebki
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.
Re: how i can have one date picker in iOS and Android?
Posted: Mon Jan 26, 2015 5:38 pm
by Klaus
Hi aebki,
beauty lies in the eye of the beholder!
And Apple's beholder is Jonathan Ives at the moment
Best
Klaus
Re: how i can have one date picker in iOS and Android?
Posted: Mon Jan 26, 2015 11:57 pm
by aebki
Regards.
Re: how i can have one date picker in iOS and Android?
Posted: Tue Jan 27, 2015 10:55 am
by aebki
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.
Re: how i can have one date picker in iOS and Android?
Posted: Tue Jan 27, 2015 11:12 am
by Dixie
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
Re: how i can have one date picker in iOS and Android?
Posted: Tue Jan 27, 2015 1:51 pm
by aebki
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.
Re: how i can have one date picker in iOS and Android?
Posted: Tue Jan 27, 2015 1:55 pm
by Klaus
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
Re: how i can have one date picker in iOS and Android?
Posted: Tue Jan 27, 2015 3:20 pm
by Dixie
Oops... the name of the variable 'red' is my fault...

not aebki's... I often just use what comes into my head when writing snippets..

Re: how i can have one date picker in iOS and Android?
Posted: Tue Jan 27, 2015 3:28 pm
by Klaus
Sheesh...

Re: how i can have one date picker in iOS and Android?
Posted: Tue Jan 27, 2015 4:45 pm
by aebki
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.
Re: how i can have one date picker in iOS and Android?
Posted: Tue Jan 27, 2015 4:57 pm
by Klaus
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