B4J Question JFXtrasDateTextField cannot set date

Hilton

Active Member
Licensed User
Longtime User
Hi,

I am trying to teach myself the use of the TableView. I have made quite a lot of progress thanks to the help from the forum, but I seem to be having a bit of trouble here.

I have a TableView that contains a person's name and dateOfBirth. The Dob is in "dd/MM/yyyy" format. when a TableView line is selected, I display the name in a textField and the dob in the
JFXtrasDateTextField. However, the Dob will not change. Here is the code snippet that does it

<code>
DateTime.DateFormat = "dd/MM/yyyy"
dt = DateTime.DateParse(lbl1.Text) ' dt is long
Log("datetime: " & lbl1.Text & " " & dt) 'shows that date extracted from tview ok
txtDob.DateFormat = "dd/MM/yyyy" 'JFXtrasDateTextField
txtDob.DateTime = dt 'visually, date does not change
</code>

Can anyone spot my obvious mistake, please.

Thanks,
Hilton.
 

Hilton

Active Member
Licensed User
Longtime User
Hi,

Attached please find zipped project as requested.

Thanks.
Hilton
 

Attachments

  • learning.zip
    8 KB · Views: 245
Upvote 0

Hilton

Active Member
Licensed User
Longtime User
Sure, here it is.

Hilton.
 

Attachments

  • folk.zip
    892 bytes · Views: 251
  • folk.zip
    892 bytes · Views: 247
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I wasn't able to test your code.

However with a simple project it seems to work fine:
B4X:
Sub Process_Globals
   Private fx As JFX
   Private MainForm As Form
   Private dob As JFXtrasDateTextField
End Sub

Sub AppStart (Form1 As Form, Args() As String)
   MainForm = Form1
   'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
   MainForm.Show
   dob.Initialize("dob")
   MainForm.RootPane.AddNode(dob, 0, 0, 200, 100)
   dob.DateTime = DateTime.DateParse("02/23/2007")
End Sub
 
Upvote 0

Hilton

Active Member
Licensed User
Longtime User
Hi Erel,

I have written a custom dialog which uses the datepicker and date fields that I have written functions for and all is well. However, I will try what you have done and see if it works. Consider this closed and Thank you for your help.

Bye,
Hilton.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…