B4J Question [ABMaterial] B4JS - cannot get it running

Discussion in 'B4J Questions' started by OliverA, Jun 20, 2019.

  1. OliverA

    OliverA Expert Licensed User

    The demo for B4JS works. But when I try to use B4JS, I just get a spinning circle and the Browser's console shows:
    b4jstest is the B4JS class module I created.
    Steps I performed:
    Copy ABMaterial's Template and rename main file.
    Add TestPage ABM Web Page class module. In BuildPage, create the following grid
    Code:
    page.AddRowsM(1,True,20,0"").AddCells12MP(1,0,0,0,0,"")
    In ConnectPage, add the following code
    Code:
    Dim btnTest As ABMButton
       btnTest.InitializeFlat(
    page"btnTest""""""Test Button""")
       btnTest.B4JSUniqueKey = 
    "myb4jsid"
       btnTest.B4JSOnClick(
    "B4JSTest""toast"Null)
       
    page.Cell(1,1).AddComponent(btnTest)
    Add B$JSTest ABM B4JS class module with following content
    Code:
    'Class module
    Sub Class_Globals
       
    ' use Public or Dim if you want to share this variable over ALL B4JS classes
       ' use Private if only within this class
       Public ABM As ABMaterial 'ignore, just to access the constants   
       Public Page As ABMPage 'ignore, just to be able to run ABMPage B4JS functions   
       
       
    End Sub

    'Initializes the object. You can NOT add parameters to this method.
    'MUST be called InitializeB4JS is automatically called when using this class
    Public Sub InitializeB4JS
       
    End Sub

    public Sub toast()
       
    Page.B4JSShowToast("1""""Hello World"3000False)
    End Sub
    #if JAVASCRIPT

    #End If
    Run ABM application in either Debug or Release mode and get unending spinning circle with the error message show above in the console log.
    If I comment out these two lines
    Code:
    'btnTest.B4JSUniqueKey = "myb4jsid"
    'btnTest.B4JSOnClick("B4JSTest", "toast", Null)
    in TestPage's ConnectPage method, the ABM application runs (and displays the lonely button).

    B4J version: 7.32
    ABMaterial version: 4.51
    Java: 8v212 and 11

    I'm attaching the files that are different/new from the standard ABM Template. I've got a feeling that it is something silly on my end, I just can't see/find it.
     

    Attached Files:

  2. Harris

    Harris Well-Known Member Licensed User

    What does the inspect / console of the browser say what's missing?
    It should state missing resources.
     
  3. OliverA

    OliverA Expert Licensed User

    The only thing that seems to be missing is
    That is not requested when I comment out the two lines I mentioned.
     
  4. OliverA

    OliverA Expert Licensed User

    The console also has this error message (just before the not defined error in post #1)
    and going to that line in that file there is
    Code:
    swaloptions.rtl: _b4jsthemes["msgbox-" + ThemeName].RightToLeft;
    Looking at the lines above that and below, I think the : should be a =, but that is generated code, not my code. I changed it to a = and now I have a running example. But why did the demo run? Hm...
     
  5. OliverA

    OliverA Expert Licensed User

    Looking at the demo's b4js.xxxxxx.js file, that line does not exist (the swaloptions.rtl). So I did a Tools->Clean project on the Demo and now it has a spinning circle and it now has the same issue on the same line. So something is going on with the code generation for B4JS.
     
  6. alwaysbusy

    alwaysbusy Expert Licensed User

    Looks like a bug indeed
     
    OliverA and Harris like this.
  7. Harris

    Harris Well-Known Member Licensed User

    There are no bugs in ABM, just opportunities for feature improvements.
     
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