Simple Time picker with AI blocks

1,538 views
Skip to first unread message

Scott Ferguson

unread,
Jan 24, 2013, 2:23:55 PM1/24/13
to app-inventor-de...@googlegroups.com
TimePicker screen:


Here are some example blocks to call the time picker from your screen and displaying the returned list of values:


After a value is selected, a list of values are returned to the calling screen.

Note the list values on the Screen1 Title bar...


time_picker.zip

Taifun

unread,
Jan 24, 2013, 3:46:59 PM1/24/13
to app-inventor-de...@googlegroups.com
very nice!
Taifun

Scott Ferguson

unread,
Jan 24, 2013, 8:19:51 PM1/24/13
to app-inventor-de...@googlegroups.com


Thanks --- trying to keep it simple. Tried using the fling handler and it just seemed too complicated and I was not satisfied with the result so I removed it from the final project.
May add a timer for the minutes to auto scroll when the up or down buttons are pressed later. As it is now, the user may have to press the minutes button up to 30 times :(
---sfs

On Thursday, January 24, 2013 2:46:59 PM UTC-6, Taifun wrote:
very nice!
Taifun

Gregor Pesek

unread,
Mar 17, 2014, 2:16:15 PM3/17/14
to app-inventor-de...@googlegroups.com
Hi!
I have to make a project for school where i turn a led light on and off on arduino. I've already made the on and off button and it works perfectly. Now i only need this time picker but it doesn't work for me:(
Can youe help me please?

Scott Ferguson

unread,
Mar 18, 2014, 2:24:03 PM3/18/14
to app-inventor-de...@googlegroups.com
What do you by 'it doesn't work for me'
What do you need exactly?
---
Scott

Gregor Pesek

unread,
Mar 19, 2014, 4:16:33 AM3/19/14
to app-inventor-de...@googlegroups.com
Well when I run  the project with pone or emulator it immediately forces to close it.
Now do i have to edit it before running  or anything?

(I just opend the project and debugged it, i didn't edit it in my project, yet.)

Scott Ferguson

unread,
Mar 19, 2014, 6:27:18 PM3/19/14
to app-inventor-de...@googlegroups.com
Since AI Classic is not running on my PC anymore, I cannot really test anything.
My recommendation would be to study how the buttons work and redo it with AI2 if possible.

One way you might do it is to start with a time returned by the system clock.

Display that on the middle row.
The up buttons subtracts one from the number on the main line and displays that answer.
The Down buttons add one to the number on the main line and displays that answer.
The label above the main line displays the main line value minus 1.
The label below the main line displays the main line value plus 1.
The am/pm label just toggles between the two text values.

You must handle when 12 goes to 1 rather than adding 1 to get 13, so if the down button is pressed AND the value displayed is 12 then display 1.
If there would be enough requests to redo this in AI2 I might consider it.
---
Scott

Gregor Pesek

unread,
Mar 27, 2014, 11:16:42 AM3/27/14
to app-inventor-de...@googlegroups.com
Hi, can we get in tuch throu skype or something, because i think this won't get me anywhere :( 


On Thursday, January 24, 2013 8:23:55 PM UTC+1, Scott Ferguson wrote:

Gregor Pesek

unread,
Mar 27, 2014, 3:11:14 PM3/27/14
to app-inventor-de...@googlegroups.com
OK.. So i made my application to work with countdown so i'm very close. But my tutor still wants to have the function "at any given time"(like an alarm clock but instead of sound the light turns on, on arduino).

So i please you just for this small favour (that i have no idea how to do it :S): Can you change the blocks (see picture) so that they will work like an alarm clock insead of countdown?

If you are willing to do this i can send you the project, if it helps you.

If not can u give me some advice? :)

Have a nice day! :)


On Thursday, January 24, 2013 8:23:55 PM UTC+1, Scott Ferguson wrote:
blocks.jpg

Scott Ferguson

unread,
Mar 27, 2014, 11:47:44 PM3/27/14
to app-inventor-de...@googlegroups.com
From what I have seen here: https://groups.google.com/forum/#!searchin/programming-with-app-inventor/alarm$20clock
it appears that you cannot make an alarm clock with App Inventor unless you leave the app running in the foreground and prevent it from sleeping.
----
Scott

Scott Ferguson

unread,
Mar 28, 2014, 1:08:40 AM3/28/14
to app-inventor-de...@googlegroups.com
With that understanding here is a simple alarm clock app that displays 'dingaling' on the title bar to indicate the alarm has rung.
Put whatever blocks need to be executed inside the AlarmEvent call block.
When the alarm goes off, it turns itself off so you will have to press the OFF button to turn it back ON for the next session.
Change that behavior if you don't want it to work that way.

---

Scott



On Thursday, March 27, 2014 2:11:14 PM UTC-5, Gregor Pesek wrote:
AlarmClock.aia

Gregor Pesek

unread,
Mar 28, 2014, 1:12:18 AM3/28/14
to app-inventor-de...@googlegroups.com

Thank you! I will try it when possible.

--
(you have received this message from the App Inventor Developers Library)
---
You received this message because you are subscribed to a topic in the Google Groups "App Inventor Developers Library" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/app-inventor-developers-library/wRckXfNF8sg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to app-inventor-develope...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gregor Pesek

unread,
Mar 28, 2014, 2:39:45 AM3/28/14
to app-inventor-de...@googlegroups.com
The blocks that u made seem fine to me, but somehow it doesen't work. I tried with a text box that is hidden and when the alarm goes off it should be visable but it isn't, eaven the dingaling doesen't show up.
Though i don't know what the segment block with numbers does?



--

Scott Ferguson

unread,
Mar 28, 2014, 10:08:19 AM3/28/14
to app-inventor-de...@googlegroups.com
See this post: https://groups.google.com/forum/#!category-topic/app-inventor-developers-library/libraryprojectsself-contained/6A4YCnCuqho
I found it had a bug in that if the time was less than 10 that I needed to add a leading zero.
It works for me.
The alarm time should not have to be visible for it to be read by the Timer block.
I don't know offhand why it would not work for you.
---
Scott
To unsubscribe from this group and all its topics, send an email to app-inventor-developers-library+unsubscribe@googlegroups.com.

Scott Ferguson

unread,
Mar 28, 2014, 10:10:45 AM3/28/14
to app-inventor-de...@googlegroups.com
Did you have the alarm button set to ON?

Scott Ferguson

unread,
Mar 28, 2014, 10:18:49 AM3/28/14
to app-inventor-de...@googlegroups.com
You can use listpickers to make time entry easier:
Hours would be 01,02,...,12
Minutes and seconds would be 00,01..,59
You could also eliminate the checkboxes and put a listpicker that has AM,PM
Then you would paste all of those selections together with a Text join block and compare that to the system time.

join
   HoursLPK.Selection
   ":"
   MinutesLPK.Selection
    ":"
    SecondsLPK.Selection
    " "
    AmPmLPK.Selection


---
Scott

Scott Ferguson

unread,
Mar 28, 2014, 10:34:00 AM3/28/14
to app-inventor-de...@googlegroups.com
Stay tuned. I am working on a very simplified version using the listpickers...
---
Scott

Scott Ferguson

unread,
Mar 28, 2014, 11:34:55 AM3/28/14
to app-inventor-de...@googlegroups.com
I have just updated the post to the new design and tested it -- much simpler!

Gregor Pesek

unread,
Mar 30, 2014, 8:52:40 AM3/30/14
to app-inventor-de...@googlegroups.com
Thanks, will try when possible.

Gregor Pesek

unread,
Apr 1, 2014, 7:17:03 AM4/1/14
to app-inventor-de...@googlegroups.com
Thanks! 
Made my app with your help. I will make it a bit better and then share.
Reply all
Reply to author
Forward
0 new messages