B4A Library [Class] AnotherDatePicker - A simple "web style" date picker

Status
Not open for further replies.

padvou

Active Member
Licensed User
Longtime User
Declare a boolean module variable like DPIsShown and check it on Activity_KeyPress.
Moreover,
this command: ADP.btnCancel_Click gives me an exception :
B4X:
java.lang.RuntimeException: Object was not initialized.
    at anywheresoftware.b4a.debug.Debug.PushSubsStack(Debug.java:121)
    at uop.unicollect.anotherdatepicker._btncancel_click(anotherdatepicker.java:205)
    at uop.unicollect.main._activity_keypress(main.java:714)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
    at uop.unicollect.main$HandleKeyDelayed.runDirectly(main.java:224)
    at uop.unicollect.main$HandleKeyDelayed.run(main.java:221)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5584)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
    at dalvik.system.NativeStart.main(Native Method)
java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1

when used like this:
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
ADP.btnCancel_Click
Return True
end sub
 

padvou

Active Member
Licensed User
Longtime User
See the example in the first post. It already implements this.
Yeah, that was exaclty how I had implemented it, however I declared a different name for the ADP in the designer than the one in the Globals, that's why it was failing..
Dumb mistake of mine..
 

Adilson Jacinto

Active Member
Licensed User
Longtime User


Hi,

I cannot find "AnotherDatePicker" option in my custom view, I have added the class and referenced the DateUtils and added DatePicker layout but I can see the class in the dropdown menu
 

Adilson Jacinto

Active Member
Licensed User
Longtime User
1. What happens when you run the example code? Does it work?

2. Check the CustomListView example: https://www.b4x.com/android/forum/t...xible-list-based-on-scrollview.19567/#content ?

Do you see the custom type there?

1. What happens when you run the example code? Does it work? - It does not work, it does show the AnotherDatePicker class in the custom view type
2. Check the CustomListView example: - Yes I tried that example and it has the class in there
Do you see the custom type there? - YES
 

Wolli013

Well-Known Member
Licensed User
Longtime User
Who is able to me sagem like one gets a picture in the calendar indicated instead of a number.
I left if one birthday har a candle or whatever.
What I must change.

B4X:
' Geburtstagsanzeige
    Dim Bild_Geburtstag As Bitmap
    Bild_Geburtstag.Initialize(File.DirAssets, "geburtstag.png")
  
    If day &"." & month = Geburtstag Then
    cvs.DrawText(day, (((dayOfWeekOffset + day - 1) Mod 7) + 0.5) * boxW, _
    (row + 0.5)* boxH + vCorrection, Typeface.DEFAULT_BOLD, Label1.TextSize, Colors.Black, "CENTER")
    End If
' Geburtstagsanzeige
 

Wolli013

Well-Known Member
Licensed User
Longtime User
So it works
B4X:
Private Sub DrawDays

' Geburtstagsanzeige
If day & "." & month = Geburtstag Then
DrawGeburtstag(cvs, selectedColor, (dayOfWeekOffset + day - 1) Mod 7, (dayOfWeekOffset + day - 1) / 7)
End If
' Geburtstagsanzeige

End Sub

Private Sub DrawGeburtstag(c As Canvas, clr As Int, x As Int, y As Int)

Dim Bitmap1 As Bitmap
Bitmap1.Initialize(File.DirAssets, "geburtstag.png")
Dim r As Rect
r.Initialize(x * boxW, y * boxH, (x + 1) * boxW, (y + 1) * boxH)
cvs.DrawBitmap(Bitmap1, Null, r)

End Sub
 

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
Hi,

I have a problem with anotherdatepicker. When I try to open, I have an error, "the panel should be inicialized", curiolsly, in the previous form, the anotherdatepicker works perfectly.

Thanks for your help
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…