T toro1950 Active Member Licensed User Nov 26, 2025 #1 Hi, I'm using Alexander Stolte's AS_DatePicker library with great satisfaction. When the app starts, it displays the current month and day. I'd like to have the app automatically select the day. Is this possible, and if so, how? Thanks in advance
Hi, I'm using Alexander Stolte's AS_DatePicker library with great satisfaction. When the app starts, it displays the current month and day. I'd like to have the app automatically select the day. Is this possible, and if so, how? Thanks in advance
oliverhaven13 New Member Nov 26, 2025 #2 Yes, it’s possible. When the DatePicker is created, you can just set its selected_date (or set_selected_date, depending on the version). If you pass date.today() right after initializing the widget, it will highlight the current day automatically. I’m using it this way and it works fine. Upvote 0
Yes, it’s possible. When the DatePicker is created, you can just set its selected_date (or set_selected_date, depending on the version). If you pass date.today() right after initializing the widget, it will highlight the current day automatically. I’m using it this way and it works fine.
asales Expert Licensed User Longtime User Nov 26, 2025 #3 B4X: Dim sel_date As Long = DateTime.Add(DateTime.Now, 0, 0, -2) '2 days ago or which date that you want AS_DatePicker1.SelectedDate = sel_date Upvote 0
B4X: Dim sel_date As Long = DateTime.Add(DateTime.Now, 0, 0, -2) '2 days ago or which date that you want AS_DatePicker1.SelectedDate = sel_date
T toro1950 Active Member Licensed User Nov 26, 2025 #4 Thank you asales, the day is displayed but not selected, I need to simulate the choice made with the manual tap, practically simulate the sub Private Sub AS_DatePicker1_SelectedDateChanged(Date As Long) Upvote 0
Thank you asales, the day is displayed but not selected, I need to simulate the choice made with the manual tap, practically simulate the sub Private Sub AS_DatePicker1_SelectedDateChanged(Date As Long)
Alexander Stolte Expert Licensed User Longtime User Nov 26, 2025 #5 toro1950 said: Thank you asales, the day is displayed but not selected, I need to simulate the choice made with the manual tap Click to expand... In my libraries, if there is something to note about a property or function, I always write a description. After you have set SelectedDate, you must call .Refresh. Just like @asales did, but with the following addition: B4X: Dim sel_date As Long = DateTime.Add(DateTime.Now, 0, 0, -2) '2 days ago or which date that you want AS_DatePicker1.SelectedDate = sel_date AS_DatePicker1.Refresh Upvote 0
toro1950 said: Thank you asales, the day is displayed but not selected, I need to simulate the choice made with the manual tap Click to expand... In my libraries, if there is something to note about a property or function, I always write a description. After you have set SelectedDate, you must call .Refresh. Just like @asales did, but with the following addition: B4X: Dim sel_date As Long = DateTime.Add(DateTime.Now, 0, 0, -2) '2 days ago or which date that you want AS_DatePicker1.SelectedDate = sel_date AS_DatePicker1.Refresh
T toro1950 Active Member Licensed User Nov 26, 2025 #6 This doesn't solve my problem; it doesn't simulate clicking (tapping) on the day. I solved it this way: I created a sub called selection, and inside it I put the code from the sub AS_DatePicker1_SelectedDateChanged(Date As Long). When called by a click, it calls the selection sub. Then I put the code you gave me at the end of the AS_DatePicker1_CustomDrawHeader sub, calling the selection sub. maybe a little cumbersome but it works, anyway thank you all Upvote 0
This doesn't solve my problem; it doesn't simulate clicking (tapping) on the day. I solved it this way: I created a sub called selection, and inside it I put the code from the sub AS_DatePicker1_SelectedDateChanged(Date As Long). When called by a click, it calls the selection sub. Then I put the code you gave me at the end of the AS_DatePicker1_CustomDrawHeader sub, calling the selection sub. maybe a little cumbersome but it works, anyway thank you all