Mar 21, 2013 Replies: 244 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: 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: 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 AnotherDatePicker.zip 13.2 KB · Views: 4,481 Last edited: Feb 18, 2019 Click to expand...
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: 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: 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.
Erel B4X founder Staff member Licensed User Longtime User Jan 19, 2015 #121 The current implementation of ADP adds a "holder" panel that covers the whole screen with the actual picker at the middle. This makes ADP act as a dialog.
The current implementation of ADP adds a "holder" panel that covers the whole screen with the actual picker at the middle. This makes ADP act as a dialog.
tdocs2 Well-Known Member Licensed User Longtime User Jan 19, 2015 #122 Erel said: The current implementation of ADP adds a "holder" panel that covers the whole screen with the actual picker at the middle. This makes ADP act as a dialog. Click to expand... Thank you, Erel. I realize that ADP is superior, but I was wondering what problems exist with Dialog.Date as I have used it in Android 4.4 and 5.0. I know that it does not handle leap years 1900 and 2100 correctly, but other than that I have not found any problems Best regards. Sandy PS: I did not find this ADP thread until very recently - I have to improve my search skills in the forum.
Erel said: The current implementation of ADP adds a "holder" panel that covers the whole screen with the actual picker at the middle. This makes ADP act as a dialog. Click to expand... Thank you, Erel. I realize that ADP is superior, but I was wondering what problems exist with Dialog.Date as I have used it in Android 4.4 and 5.0. I know that it does not handle leap years 1900 and 2100 correctly, but other than that I have not found any problems Best regards. Sandy PS: I did not find this ADP thread until very recently - I have to improve my search skills in the forum.
Erel B4X founder Staff member Licensed User Longtime User Jan 19, 2015 #123 DateDialog is based on the native date picker. In the past there were devices that didn't show it properly. However there is nothing bad about it. This is just another implementation of a date picker.
DateDialog is based on the native date picker. In the past there were devices that didn't show it properly. However there is nothing bad about it. This is just another implementation of a date picker.
barx Well-Known Member Licensed User Longtime User Jan 19, 2015 #124 As erel states, it is just visualisation issues. On some devices it tries to show the month overview and the picker elements but they don't fit on the screen so it looks bad.
As erel states, it is just visualisation issues. On some devices it tries to show the month overview and the picker elements but they don't fit on the screen so it looks bad.
tdocs2 Well-Known Member Licensed User Longtime User Jan 19, 2015 #125 Thank you, Erel. Thank you, BarX.
seardnA Member Licensed User Longtime User Jan 30, 2015 #126 Erel said: Please use [ code ] [ /code ] tags (without spaces) when posting code. Can you upload a small project with only ADP and the problem you encounter? Click to expand... Rehi ! Can I give it another try with code before I upload a small project? I read the parameter p.pBirthdate using: Code: Sub BtnBirthDate_LongClick DateTime.DateFormat = "MM/dd/yyyy" p.pBirthdate= DateTime.Date(ADP.GetDate) Log(DateTime.Date(ADP.GetDate)) Log(P.pBirthdate) edtHi.text="Birthdate stored as " & p.pBirthdate End Sub with ADP.GetDate as long, DateTime.Date giving back a string to p.pBirthdate which is a string character. Why do I always get back P.pBirthdate = 0 or as text "Birthdate stored as 01/01/1970.
Erel said: Please use [ code ] [ /code ] tags (without spaces) when posting code. Can you upload a small project with only ADP and the problem you encounter? Click to expand... Rehi ! Can I give it another try with code before I upload a small project? I read the parameter p.pBirthdate using: Code: Sub BtnBirthDate_LongClick DateTime.DateFormat = "MM/dd/yyyy" p.pBirthdate= DateTime.Date(ADP.GetDate) Log(DateTime.Date(ADP.GetDate)) Log(P.pBirthdate) edtHi.text="Birthdate stored as " & p.pBirthdate End Sub with ADP.GetDate as long, DateTime.Date giving back a string to p.pBirthdate which is a string character. Why do I always get back P.pBirthdate = 0 or as text "Birthdate stored as 01/01/1970.
Erel B4X founder Staff member Licensed User Longtime User Jan 30, 2015 #127 What is the log output of this sub? What is p?
seardnA Member Licensed User Longtime User Jan 30, 2015 #128 Hi ! p is a class modul Code: Sub Class_Globals Public pID As Int Public pFirstName, pLastName, pBirthDate, pCountryOfOrigin As String Public pLifeExp As Long End Sub What I saw when I set a breakpoint at Sub BtnBirthDate_LongClick is that the value of selectedDate was always 0 Code: Public Sub GetDate As Long Return selectedDate End Sub The log was always 01/01/1970. I use DateUtils - Version 1.05; 'AnotherDatePicker - v1.11;B4a 3.2 Last edited: Jan 31, 2015
Hi ! p is a class modul Code: Sub Class_Globals Public pID As Int Public pFirstName, pLastName, pBirthDate, pCountryOfOrigin As String Public pLifeExp As Long End Sub What I saw when I set a breakpoint at Sub BtnBirthDate_LongClick is that the value of selectedDate was always 0 Code: Public Sub GetDate As Long Return selectedDate End Sub The log was always 01/01/1970. I use DateUtils - Version 1.05; 'AnotherDatePicker - v1.11;B4a 3.2
Erel B4X founder Staff member Licensed User Longtime User Feb 1, 2015 #129 Can you upload your project (File - Export as zip)?
seardnA Member Licensed User Longtime User Feb 1, 2015 #130 Hi Erel, Uploaded. Attachments n0.zip n0.zip 137.2 KB · Views: 626
Erel B4X founder Staff member Licensed User Longtime User Feb 2, 2015 #131 There is a warning about ADP not being initialized:
Y yuval Member Licensed User Longtime User Mar 13, 2015 #132 Reinierus said: Hello. I solved my problem!! Click to expand... hi, how did you solve this problem ? i got it too. thanks
Reinierus said: Hello. I solved my problem!! Click to expand... hi, how did you solve this problem ? i got it too. thanks
Y yuval Member Licensed User Longtime User Mar 13, 2015 #133 I moved the code that calls the adp to the activity resume from the activity create, and it solved the problem!!
I moved the code that calls the adp to the activity resume from the activity create, and it solved the problem!!
Arf Well-Known Member Licensed User Longtime User Mar 20, 2015 #134 This works great, love it. I am having a small problem though, and thats with the display of the CustomView box in my app - the one if clicked, opens the date picker. I've got some strange border around it I want to get rid of. Pic below, any ideas? I've tried removing borders etc in the designer but no luck.
This works great, love it. I am having a small problem though, and thats with the display of the CustomView box in my app - the one if clicked, opens the date picker. I've got some strange border around it I want to get rid of. Pic below, any ideas? I've tried removing borders etc in the designer but no luck.
Arf Well-Known Member Licensed User Longtime User Mar 21, 2015 #135 Solved, just needed to set the CustomView color to that of my background.
B B_FISH Member Licensed User Longtime User Apr 14, 2015 #136 Maybe this is already answered..... But how do you see the designer view for the class itself? I'm only able to see the designer view for the program that is USING this class. (That is, the DEMO program) B_FISH
Maybe this is already answered..... But how do you see the designer view for the class itself? I'm only able to see the designer view for the program that is USING this class. (That is, the DEMO program) B_FISH
Erel B4X founder Staff member Licensed User Longtime User Apr 15, 2015 #137 Not sure that I understand. After you add the class module to your project you should be able to add a CustomView item to the designer and then set its custom type class property.
Not sure that I understand. After you add the class module to your project you should be able to add a CustomView item to the designer and then set its custom type class property.
B B_FISH Member Licensed User Longtime User Apr 15, 2015 #138 Sorry..... I wasn't clear. When you have more than one module in the IDE, I didn't know how to switch to the Designer (.bal file) for other modules. It, by default, seems to always shows the main one when first loading the project. Anyhow I found the way to load the other ones (if any exist) under the Designer menu. B_FISH
Sorry..... I wasn't clear. When you have more than one module in the IDE, I didn't know how to switch to the Designer (.bal file) for other modules. It, by default, seems to always shows the main one when first loading the project. Anyhow I found the way to load the other ones (if any exist) under the Designer menu. B_FISH
padvou Active Member Licensed User Longtime User Jun 16, 2015 #139 Thank you for this Class. I had to add the following code to see the control: Code: Public Sub Front holder.BringToFront DrawDays End Sub
Thank you for this Class. I had to add the following code to see the control: Code: Public Sub Front holder.BringToFront DrawDays End Sub
Alberto Michelis Well-Known Member Licensed User Longtime User Jul 3, 2015 #140 In order to use this class in your code you should add AnotherDatePicker class How to do it??