B4A Library [Class] AnotherDatePicker - A simple "web style" date picker

Status
Not open for further replies.
This is an old version. Latest version is included in XUI Views: https://www.b4x.com/android/forum/threads/100836/#content

AnotherDatePicker is an inline date picker:

SS-2016-02-10_17.26.22.png


The advantage of this class over the built-in dialog (DateDialog from the Dialogs library) is that you can easily customize it as needed.

Most of the layout is created with the visual designer and designer script.

ADP.GetDate returns the selected date.

The months names and days names are based on the device locale.

In order to use this class in your code you should add AnotherDatePicker class, reference DateUtils library and add DatePicker layout file to the Files tab.

Starting from v2.0, ADP should be added as a custom view from the designer:

SS-2016-02-10_17.26.57.png


v2.0 - Better support for visual designer and more configurable options (including first day of week).
v1.11 - Fixes an issue with SetDate that is called before the view is ready.
v1.10 - Adds a Closed event. See the attached example.
 

Attachments

  • AnotherDatePicker.zip
    13.2 KB · Views: 3,764
Last edited:

IslamQabel

Active Member
Licensed User
Longtime User
It is ALWAYS better to create a NEW THREAD for EACH question.

Use Datetime methods......

https://www.b4x.com/android/help/core.html#datetime
thanks ....i already know how to get dayofweek as DateTime.getdayofweek(DateTime.now)..........but my question is...when you use datedialog.....you can see the calender and pick all date data at any other date year,month,dayofmonth but i want to get also the dayofweek at the picked date by dialog
 

Polaris

Member
Licensed User
View attachment 69363 View attachment 69362
As promised here is my edit (See attached below). Please note that I only edited a few minor UI things, nothing special or functional.

A few of the colors are slightly different to my screenshot, mainly due to, the app I posted screenshot from uses a Custom Light theme, so default texts are dark. Applying that to the sample would just complicate matters.

Anybody that uses Erel original class files, one thing I would add to the DatePicker designer layout script is:

Add
B4X:
Base.Height = Min(300dip, 100%y)

Just after
B4X:
AutoScaleAll

If Erel agrees with this, maybe he will update the original for those that don't read past post #1 :cool:
On my phone 480x800 I found that the bottom of the date picker would be cropped slightly in landscape mode. Adding the above line solves that issue.

Updated to reflect Erels update to DateUtils (now v1.03)

Thanks again Erel, great class.



Hi Barx I tried out your version of ADP, looks good , but I get a funny bug , don't know if anyone else gets it, what happens is the btnPicker button is always visible even when it shouldn't be. When btnPicker is clicked the adp view appears as it should but the btnPicker button sits right there in the middle of the adp calendar view. In the designer settings I tried setting the elevation at 3dip so it would be above the "1" view, but still no go. I can set (btn.picker.Visible=False) in the btnPicker_click sub, that makes it go away when the date picker is called, but then i can't get it back when I exit adp view since there is no place to call (btn.picker.Visible=True) in MAIN.
Trying to access the btnPicker from AnotherDatePicker using MAIN.btnPicker doesn't work either (Unknown member error).
I'm really curious about this bug, while it's no big deal, still I think solving it will help me learn something new, so I appreciate it if anyone has any ideas ?
Screenshot_20180627-000831.png
 
Last edited:

Alessandro71

Well-Known Member
Licensed User
Longtime User
View attachment 69363 View attachment 69362
Hi Barx I tried out your version of ADP, looks good , but I get a funny bug , don't know if anyone else gets it, what happens is the btnPicker button is always visible even when it shouldn't be. When btnPicker is clicked the adp view appears as it should but the btnPicker button sits right there in the middle of the adp calendar view.

i have the same issue
a button from my activity is displayed over datepicker, even if it is the first in the editor treeview, so it should be in the background
did you solved your issue?
 
Status
Not open for further replies.
Top