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,553
Last edited:

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
If I execute in debug mode, the control works, the problem appears when I work in release mode. The strange thing is that I the strange thing is that I have the same instructions in other forms and works well
 

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
Thanks Erel!!. I attach my code. I add the red line in activity_create. The anothedatepicker name is "ADP", it's the format OK???

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:

Activity.LoadLayout("DatosGenerales")
Activity.Title=Main.strEstG



DateTime.DateFormat="dd/MM/yyyy"

CallSubDelayed(ADP,"AddToActivity")
ADP.SetDate(DateTime.now, True)


If FirstTime Then
GPS_Tablet.Initialize("GPS_Tablet")
End If

blnGuardar=True

FillDatosGenerales
'
End Sub
 

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
Hi again

I check the line and logically does not work. I check that "AddToActivity" is a sub included in "anotherdatepicker" control. I dont´know as I can call to datepicker with callsubdelayed.

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
I think you misinterpreted erels answer.

Add the Datepicker in Activity_create and call a sub with callsubdelayed which then will set the date you want to have in the datepicker...
In the delayed sub you place the
B4X:
ADP.SetDate(DateTime.now, True)

But maybe it´s just me which misinterpreted the answer!? :D
 

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
J je je.... yes yes I put in all my forms (activity_create) that use anotherdatepicker, the rutine "ADP.SetDate(DateTime.now, True)" (you can observe my code line in the last mail) but in any occasions the control stop to work and I have an error, "the panel should be inicialized", and the programm is stopped. We don´t understand where the mistake is.

Thanks Manfred
 

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
Thanks Erel, i'll try now.. I've finished the APK and I don´t know if it´'s a good idea to modify the control now
 

Humberto

Active Member
Licensed User
Longtime User
I´m trying the sample in post #1 and I´m geting the error in attach
Some one can help ?

My b4a version is 5.50

Thnaks
 

Attachments

  • error.png
    error.png
    70.6 KB · Views: 189
Status
Not open for further replies.
Top