B4J Library jAnotherDatePicker (class)

Discussion in 'B4J Libraries & Classes' started by Erel, Jan 16, 2014.

  1. Erel

    Erel Administrator Staff Member Licensed User

    [​IMG]

    This is a date picker similar to B4A AnotherDatePicker.

    In order to use it in your project, you should choose Project - Add existing module and add jAnotherDatePicker to your project. You should also add the DatePicker layout file and calendar_icon.png.

    It is implemented as a custom view. It should be added from the designer.
     

    Attached Files:

    Last edited: Mar 2, 2016
  2. sanjibnanda

    sanjibnanda Active Member Licensed User

    good one... thanks for class
     
  3. frsimon

    frsimon New Member Licensed User

    That zip doesn't contain a layout file. Am I missing something.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    No. The layout is created programmatically.
     
  5. tdocs2

    tdocs2 Well-Known Member Licensed User

    Greetings.

    Thank you for your replies to this Newbie question.

    1. I am using the Open Designer for my app. I do not have any FXML layouts.
    2. When I click on Designer, Scene Builder Layouts, it gives me one Choice - Create New.
    3. As instructed,
    .
    How do I add the DatePicker layout file to my project?

    Obviously, I was able to add the jAnotherDatePicker module to the project.

    Thanks again.

    Sandy
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    You need to add DatePicker.fxml file from the zip file to your project Files tab.
     
    tdocs2 likes this.
  7. tdocs2

    tdocs2 Well-Known Member Licensed User

    Thank you, Erel.

    I followed your instructions, and I received the error below. My app is looking for DatePicker.bjl and not for DatePicker.fxml... I do not know how to tell my app to look for the fxml (which is in the Files Folder). That was my poorly worded question in the post above.

    Code:
    Program started.
    janotherdatepicker._initialize (java line: 
    269)
    java.io.FileNotFoundException: DatePicker.bjl
        at anywheresoftware.b4a.objects.streams.File.OpenInput(
    File.java:180)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:
    43)
        at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:
    76)
        at b4j.example.janotherdatepicker._initialize(janotherdatepicker.java:
    269)
        at b4j.example.main._appstart(main.java:
    57)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    43)
        at java.lang.reflect.Method.invoke(Method.java:
    497)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    93)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:
    84)
        at b4j.example.main.start(main.java:
    36)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$
    159(LauncherImpl.java:863)
        at com.sun.javafx.application.LauncherImpl$$Lambda$
    53/10423575.run(Unknown Source)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$
    172(PlatformImpl.java:326)
        at com.sun.javafx.application.PlatformImpl$$Lambda$
    45/1681433494.run(Unknown Source)
        at com.sun.javafx.application.PlatformImpl.lambda$
    null$170(PlatformImpl.java:295)
        at com.sun.javafx.application.PlatformImpl$$Lambda$
    48/1334252076.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$
    171(PlatformImpl.java:294)
        at com.sun.javafx.application.PlatformImpl$$Lambda$
    47/1685538367.run(Unknown Source)
        at com.sun.glass.ui.InvokeLaterDispatcher$
    Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$
    null$145(WinApplication.java:101)
        at com.sun.glass.ui.win.WinApplication$$Lambda$
    36/2058534881.run(Unknown Source)
        at java.lang.Thread.run(
    Thread.java:745)
     
  8. tdocs2

    tdocs2 Well-Known Member Licensed User

    I GOT IT!

    Add MEANS In Project Files Tab > Add File - not just copy the fxml to the Files folder.

    Thank you, Erel, for your patience :):):cool: (in FL, USA, you need sunglasses)
     
    inakigarm likes this.
  9. ivan.tellez

    ivan.tellez Active Member Licensed User


    Actualy you can "just copy" the fxml to the Files folder. Then, click on the "Sync" Button in the Files Tab.
     
    tdocs2 likes this.
  10. le_toubib

    le_toubib Active Member Licensed User

    hi all
    after adding the module and the layout file
    i get this error :

    at the line of this code 81: MainForm.RootPane.LoadLayout("lo2") 'Load the layout file.

    Code:
    MainForm = Form1
            CurrentState = 
    "Initiating"
            MainForm.Initialize(
    "mainform",-1,-1)
            MainForm.SetFormStyle(
    "DECORATED")
            SetSystemProperty(
    "glass.accessible.force""false")
            MainForm.RootPane.LoadLayout(
    "lo2"'Load the layout file.
            MainForm.Show
           dp_pt_spn_dob.Initialize(MainForm)
    what am i doing wrong ?

    p.s :
    i also get this worning from the downloaded project itself : this sub should be used for variable declarations or assignemnts of primitive values
    a this line :
    Private selectedColor As Paint = fx.Colors.RGB(144, 176, 248)
     
  11. le_toubib

    le_toubib Active Member Licensed User

    Ok , i restarted everything, and now it's working , with the same worning though.
    But when i moved to another device, i get another error, upon clicking on the text field the date picker starts to appear and then the app crash ;
    Java(TM) platform SE has stopped working
    BEX64
     
    Last edited: Mar 2, 2016
  12. Erel

    Erel Administrator Staff Member Licensed User

    How did you create the layout file? Custom views will only work with the internal designer.
     
  13. le_toubib

    le_toubib Active Member Licensed User

    I found both 1.fxml and datepicker.Fxml can be opened in scene builder?
    My original (very big) layout file was created in scene builder.
    Why is it working perfectly on one device? And the whole java.exe crashes on another ?
     
  14. Erel

    Erel Administrator Staff Member Licensed User

    The first post was updated with the latest version of jAnotherDatePicker. It is now implemented as a custom view.

    I recommend you to switch to the new implementation. You can load it to a pane in your existing layout.
     
  15. le_toubib

    le_toubib Active Member Licensed User

    You wonna say to create a pane inside my layout in scene builder.
    And then load the pane with the datepicker. Fxml layout?
    Should the pane be invisible at first?
    What about the .Show property?
     
  16. Erel

    Erel Administrator Staff Member Licensed User

    And then load a bjl layout that holds the custom view. There is no show method. It opens when the user clicks on the calendar icon (you can add a show method if you like).
     
  17. le_toubib

    le_toubib Active Member Licensed User

    OK :
    for some reason i had an older version of adp with fxml not bjl...

    now what i did :
    1- i created i new layout dp.bjl inside which i created the custom view "AnotherDatePicker"
    2- i have my original lo2.fxml , inside which i added a pane node , then i loadlayout("dp") for this new node
    3- in the project it shows correctly and when i press on the icon the datepicker is shown correctly
    4- but the AnotherDatePicker_DateChanged (NewDate As Long) event is not raised when the date is changed

    EDIT :

    sorry that was a mistake in naming the view ..
    now working fine.
    but had to set a boolean variable to prevent the trigger of the event before changing the date ( as it s triggered on show)
     
    Last edited: Mar 2, 2016
  18. le_toubib

    le_toubib Active Member Licensed User

    Alright everything it's working fine on my win 10 laptop ... But when i moved to win 7 desktops the whole app crash at the line ;

    Frm.showandwait

    In the class module
    Is there any explanation ?
     
  19. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for this and post the logs.
     
  20. roberto64

    roberto64 Active Member Licensed User

    regardsErnel hello, how can I display any Another DATEPICKER1 a different date es. (AnotherDatePicker1.Date = m.Get ("datapreventivo"), he writes in AnotherDatePicker1.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice