DatePicker disable TouchDown

703 views
Skip to first unread message

Louis Hyacinthe

unread,
Nov 20, 2019, 4:17:38 PM11/20/19
to MIT App Inventor Forum
Thanks in advance for your time and answers.


Is there a way to disable DatePicker.TouchDown?  I am writing an app where the user should only select future dates.  I am using a DatePicker to allow the user to select a date.  I know that I can check DatePicker.AfterDateSet, and compare it to systemTime


-Louis

TimAI2

unread,
Nov 20, 2019, 4:47:28 PM11/20/19
to MIT App Inventor Forum
Use a button to call the datepicker (you can hide the datepicker button)
Ten you can use the button events to disable touch down.

Louhya

unread,
Nov 20, 2019, 7:54:47 PM11/20/19
to MIT App Inventor Forum

Thanks for the quick reply.  But I don't understand what you mean.  Can you give me an example.

I have the following now and would also like to keep that capability
image.png

I don't see a property called .TouchDown to enable or disable.

By default you get this from DatePicker
image.png

I would like to get this

image.png

Louhya

unread,
Nov 20, 2019, 8:08:44 PM11/20/19
to MIT App Inventor Forum
Thanks for the quick reply.  But I don't understand what you mean.  Can you give me an example.

I have the following now and would also like to keep that capability: datepicker1.png

I don't see a property called .TouchDown to enable or disable.

By default you get this from DatePicker: datepicker2.png

I would like to get this datepicker3.png

datepicker1.png
datepicker2.png
datepicker3.png

TimAI2

unread,
Nov 21, 2019, 4:23:51 AM11/21/19
to MIT App Inventor Forum
See attached simple example of what I mean
disabledatepicker.aia

Louhya

unread,
Nov 21, 2019, 6:59:22 AM11/21/19
to MIT App Inventor Forum
Thanks again Tim,

I need to disable the TouchDown buttons not the DatePicker.  I also found
Date before Today, which you authored, which is closer to what I would need.


I think what I am asking in not possible right now.  It would be a nice enhancement.

TimAI2

unread,
Nov 21, 2019, 7:05:43 AM11/21/19
to MIT App Inventor Forum
Sounds like you want to introduce a test if the date selected is before today ?
If it is return user to the date picker

ABG

unread,
Nov 21, 2019, 1:03:34 PM11/21/19
to MIT App Inventor Forum
You could build your own version of a Date Picker, stacking
up 6 buttons and 3 labels.
(+)  (+)  (+)
MM DD YYYY
(-)   (-)   (-)

At startup and after each update, enable or disable
each button depending on whether or not it would
generate an acceptable date.

ABG

ABG

unread,
Nov 21, 2019, 1:54:54 PM11/21/19
to MIT App Inventor Forum
See attached for a sample future date picker.
It's impossible to pick anything earlier than tomorrow.
ABG

Capture.PNG
Designer.PNG
future_date_picker.aia
blocks.png

Louhya

unread,
Nov 22, 2019, 12:09:20 PM11/22/19
to MIT App Inventor Forum
Thanks! Everyone for all the great solutions.


ABG thanks a lot.


Reply all
Reply to author
Forward
0 new messages