B4J Question [ABMaterial] action button

jayel

Active Member
Licensed User
Longtime User
Can this button fire a clicked event?
I supposed it could :

B4X:
Dim btnaction1 As ABMActionButton
    btnaction1.Initialize(page,"btnOpslaan" & counter,"mdi-content-save","red")
    btnaction1.MainButton.size = ABM.BUTTONSIZE_LARGE
    Tabc.Cell(1,2).AddComponent(btnaction1)

B4X:
Sub btnOpslaan1_Clicked(Target As String, SubTarget As String)
    Dim mykraan As kraan
    mykraan = Main.Kranen.Get(0)
    Log(mykraan.MachineNaam)
    Dim mytab As ABMTabs = page.Component("tabs")
    Dim mytabcontainer As ABMContainer = mytab.GetTabPage("tab1")
  
    Dim commid As ABMInput = mytabcontainer.Component("txtcommid1")
    Dim id As ABMInput = mytabcontainer.Component("txtid1")
    Dim combotype As ABMCombo = mytabcontainer.Component("cmdtype1")
    Dim checkcontrole As ABMCheckbox = mytabcontainer.Component("chkcontrole1")
    Dim produktomschrijving As ABMInput = mytabcontainer.Component("txtproduktomschrijving1")
   
End Sub

But the event doesn't fire :
My console log says :
(index):1 Uncaught ReferenceError: actionbuttonclickarray is not defined

Am I doing something wrong?
 

Mashiane

Expert
Licensed User
Longtime User
To trap the main button click event, found this on the demo example..

B4X:
If SubTarget="" Then
        Log("clicked main button")
        Return
    End If

Then you can put your code inside that if statement...

also your button event is btnOpslaan1 while the button is defined as "btnOpslaan" in the initialize event. perhaps correct that and see what happens...
 
Upvote 0

jayel

Active Member
Licensed User
Longtime User
No, I set I breakpoint and the event doesn't get fired, anybody else?

PS
also your button event is btnOpslaan1 while the button is defined as "btnOpslaan" in the initialize event. perhaps correct that and see what happens...
B4X:
btnaction1.Initialize(page,"btnOpslaan" & counter,"mdi-content-save","red")
Notice the counter after btnopslaan, it is a counter that starts with1, so the first buttoin would be btnOpslaan1, second btnOpslaan2, etc ...
 
Upvote 0

jayel

Active Member
Licensed User
Longtime User
It is possible that you need to refresh (F5) in the browser or/and increase the AppVersion in ABMShared as it looks like the needed libs are not loaded.

If nothing helps, try adding page.NeedsActionButton=true in the BuildPage() method to force to load the libraries needed for an ABMActionButton.

No the above doesn't work
I get this in the google console window
Uncaught ReferenceError: actionbuttonclickarray is not defined
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Then it must definitely mean your html/js/css is cached somehow. The 'actionbuttonclickarray' will be written in the generated .js file when page.NeedsActionButton = true.

open in the www, your app folder, your page folder, the .js file in e.g. notepad++ and search for 'function actionbuttonclickarray', it should be there.

Open in in chrome, press F12, in NetWork click 'disable cache', press F5
 
Upvote 0

jayel

Active Member
Licensed User
Longtime User
No the 'function actionbuttonclickarray' is NOT found in my js folder.
Even with 'disable cache' it doen't fire the event
Is it because I use a raspberry pi for debugging, do I have to manualy copy files when I want to debug?
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Then you do not have the most recent generated www files on you Pi. How do you mean 'debugging on Pi'? The B4J IDE does only run on Windows, no? So every time you click 'run' in the IDE, a new set of the www folder is generated on the PC. So at that time this is still on your PC, not on the Pi. You'll need to upload this new www folder to the Pi then. And the .needs file too.
 
Upvote 0

jayel

Active Member
Licensed User
Longtime User
I mean, I connect the B4J program with my py (remote debugging).
I press "Run" so I suppose the B4J will copy all the files for me? NO?
So everytime I want to debug (run) my app I have to kopie the www folder manually?
 
Upvote 0
Top