B4A Library EditDate Library

Component to simplify date input
Code:
' create the component
Dim edit_date1 As xnEditDate
edit_date1.Initialize("edit1_date")
Activity.AddView ( edit_date1 ,  0dip , 105dip ,  180dip , 40dip )


' setting and getting the value
Dim now As Long
now = DateTime.now

edit_date1.DateAsLong = now

now = edit_date1.DateAsLong
Msgbox ( "The date is: " & DateTime.Date(now) & CRLF & "The time is: " & DateTime.Time(now) , "" )

edit_date1.DateAsSql = "20120514"

now = edit_date1.DateAsLong
Msgbox ( "The date is: " & DateTime.Date(now) & CRLF & "The time is: " & DateTime.Time(now) , "" )

Added change event
Code:
Sub edit_date1_change
MsgBox ( edit_date1.DateAsSql , "Change" )
End Sub
 

Attachments

Last edited:
great job stefanobusetto!! :icon_clap:
 
Brilliant, Stefano!

A [Today] button between [Set] and [Cancel] would crown your library
(if that is not Fabio's meaning of "event date clear").

A cosmetic issue: Longer dates, such as "Wednesday, September 19, 2012"
cause a line break in the dialog. I tried 'EditDate.Format_display' without effect. Perhaps the default format "Wed, Sep 19, 2012" would suffice.

A minor issue, the icon shows a clock symbol whereas a calendar symbol
might be expected.

Ciao a tutti!
 
What i'd like very much is having 4 buttons ( set, cancel, clear and today).
I'd like also to be able to select which of them should be visible and which not.
This is not a problem anyway.
To select a date now i use DatePickerDialog.
The DatePickerDialog does not allow additional buttons as far as i've seen.
I've seen there are also other date selection dialogs (DateSlider for example) and i'm going to start the tests.
:)
 
What events at EditDate object?
it is necessary call procedure at date change
 
Unfortunately, I don't have the knowledge needed to create a library ... but I solved the problem by doing two different activity: one for date and other for time (with the same design as your library!)
 
Back
Top