B4A Library DateTimePicker View (Preferences DIalog)

Name: TDDateTimePicker
Lib.: b4xlib
Version: 2.01

Update!
  • Access to all Custom Properties by code

Timerpicker.png
Datepicker1.png
Datepicker3.png


Feature Overview:

  • Timepicker, modifiable by DateTime.TimeFormat Value
  • Datepicker, modifiable by DateTime.DateFormat Value
  • Individual Colors
  • Localizable Text strings for Title, Labels and Buttons
  • Graphical Calendar
  • self generated JSON File for Layout
  • Return Value as formated string

This is a Custom View you may use with the Designer or by code.

To install:
  1. Copy TDDateTime.b4xlib to your additional lib folder.
  2. In your Project activate these libraries: B4XPreferencesDialog, TDDateTimePicker.
  3. In the Designer drag the view from the views/custom views Menu on to the right page.
  4. Notice the Dimension of the view is only a placeholder, 40dip is right enough.
  5. Set the Custom Properties.
Properties by code: TDDateTimer1.DateFormat="dd.MM.yyyy"
Custom Properties Designer:
CustomProperties.png


Custom Properties by Code:

Property NameDescriptionProperty NameDescription
BackgroundColorDialog Background color (Int)TitleBarColorBackground of the Title bar (Int)
BorderColorDialog Border color (Int)TitleTextColorTitle Text Color (Int)
BodyTextColorDialog label text color (Int)InfoDateDLGDate Dialog SubTitle (string)
BorderCornerRadiusDialog Border Radius (Int)btOkText string OK Button (string)
BorderWidthDialog Border width (Int)btCancelText string Cancel Button (string)
TitleTimeDLGTimeDialog title (string)lblTimeDLGTime DIalog field labels as a formated string (see Example)
TitleDateDLGDateDialog title (string)

Set Properties by Code:
Public Sub setProperties
    ' | = Alt-124'
    TDDateTimePicker1.mprops.put("lblTimeDLG","Hour:|Minute:|Second:")
    TDDateTimePicker1.mprops.put("TitelTimeDLG","Set a Time")
    TDDateTimePicker1.mprops.put("BorderColor",0xFF047CB9)
    ' .....
End SUb


B4XPage Object initialized by Designer:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private TDDateTimePicker1 As TDDateTimePicker
End Sub

B4XPage Call the Dialog:
Private Sub Button1_Click
    DateTime.TimeFormat="HH:mm:ss"
    TDDateTimePicker1.showTimepicker
End Sub
Private Sub Button2_Click
    DateTime.DateFormat="dd.MM.yyyy"
    TDDateTimePicker1.showDateDialog
End Sub

Event to capture Dialog Result:
private Sub TDDateTimePicker1_DialogResult(Result As String)
    xui.MsgboxAsync(Result,"Result:")
End Sub

Find attached:
TDDateTimePicker.b4xlib - use this in yourB4X Suite
TDDateTimePicker.bas - use this to have look into the code.
Project.ZIP - Example B4A Project
 

Attachments

  • Project.zip
    124.2 KB · Views: 109
  • TDDateTimePicker.b4xlib
    2.5 KB · Views: 94
  • TDDateTimePicker.bas
    10.4 KB · Views: 88
Last edited:
Top