B4J Question [ABMaterial] library creation problem [SOLVED]

MichalK73

Well-Known Member
Licensed User
Longtime User
Hello.

I wanted to build a library for B4J containing ABMaterial elements for automating project writing.

If I do as a module or class in the project I am writing it works seamlessly. It is the same as throwing in ABMShared functions for example to create ABMLabel.

However, when I have accumulated a bit of this and prefer to have in the library to attach. This is where the problems start. Although the library is correctly built, you can add to the project. The project compiles, but the problem is with the display and operation on the page. For example, I added a test lib with just ABMSwitch. The page loads but does not show the graphic element of the switch. After pressing in place of the switch in the console we have an error. The same is true for some components such as input from mask, range, radio (this is displayed, but when pressed there are errors).
What could be the cause and how to solve it ?

As Standard Class:
Sub Class_Globals
    Private page As ABMPage
End Sub

'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(MyPage As ABMPage)
    page = MyPage
    
End Sub

public Sub oknotest As ABMContainer
    Dim p As ABMContainer
    p.Initialize(page, "test","")
    p.AddRow(1,True,"","").AddCells12(12,"")
    p.BuildGrid
    
    Dim Sw As ABMSwitch
    Sw.Initialize(page, "sw1","on","off",True,"")
    
    p.Cell(1,1).AddComponent(Sw)
    
    Return p
End Sub

Public Sub Switch As ABMSwitch
    Dim Sw As ABMSwitch
    Sw.Initialize(page, "sw1","on","off",True,"")
    Return Sw
End Sub

as Code Module in library:
Sub Process_Globals
    
End Sub

Public Sub Switch(page As ABMPage) As ABMSwitch
    Dim Sw As ABMSwitch
    Sw.Initialize(page, "sw1","on","off",True,"")
    Return Sw
End Sub

B4X:
    Dim ac4 As ac4
    ac4.Initialize(page)
    page.Cell(1,1).AddComponent(ac4.oknotest)
    page.Cell(1,1).AddComponent(ac4.Switch)
    page.Cell(1,1).AddComponent(ac5.Switch(page))

error.png
 

Attachments

  • libCreateLibrary.zip
    1.7 KB · Views: 145

alwaysbusy

Expert
Licensed User
Longtime User
As ABM does not know you're using an ABMSwith when analysing the code, you will have to add the needed page.needs... statements manually in the BuildPage to included the nessecairy css and javascript.

e.g.
B4X:
page.NeedsCheckbox = True
page.NeedsCombo = True
page.NeedsInput = True
page.NeedsMask = True
page.NeedsRadio = True
page.NeedsSwitch = True
...

Alwaysbusy
 
Upvote 0
Top