B4J Library [ABMaterial Poll] What to do next?

Code Monkey, next you will work on:

  • ABMXPlay

    Votes: 0 0.0%
  • Other (please specify by describing it in a new post in this topic)

    Votes: 0 0.0%

  • Total voters
  • Poll closed .


Licensed User
I now understand the grid - as I should - been experimenting long enough. It is not that difficult (however complex). It just takes some time to learn (when you know and understand you are dealing with three different perspectives - phone, tab and desktop - and 12 cells). It is quite amazing when you populate the method params with correct values! (even when not, the framework 'somehow' deals with it correctly).

The only issue I have, as I have posted somewhere else, is when I need to insert a new row within a built grid (with different cell construct).
Not a big deal, but I need to adjust the row numbering after the new row insert (cause I did not foresee the true design) - (inc each successive row by one (or x many). I tried to think about how I could accomplish this with logic code to no avail. (forgive me if you have already addressed this issue).

How to make row numbering dynamic (enum)? Right now, we reference rows as 1,2,3, etc).

Many other smart fellows may have already figured this out. Pls enlighten me.

Maybe we are stuck here because the way the compiler works.

As always, I just can't emphasis enough my joy about this marvelous framework!



Licensed User
@Harris This was indeed why the CellR() method was introduced. (The 'R' stands for relative to another row).

e.g. using cell:


What if we want to 'insert' a new component between 1 and 2?

page.cell(2,1).addComponent("...") <-- new line
page.cell(3,1).addComponent("...") <-- change line
page.cell(4,1).addComponent("...") <-- change line

Now with cellR:

page.cellR(0,1).addComponent("...") <-- the 1st row is where we are so we do not have to move relative to it (0)
page.cellR(1,1).addComponent("...") <-- relative 1 to previous
page.cellR(1,1).addComponent("...") <-- relative 1 to previous

Adding a new component
page.cellR(1,1).addComponent("...") <-- new line, the rest we can leave as it is.

All this will drastically be made easier once the Grid Editor is in place.


Licensed User
I see what you mean above. The grid generator used this (where I had not when hand coding). This shall work fine when the row you reference after has the same type of cell structure.

I have carefully laid out my initial grid with 11 rows of different formats...

 public Sub BuildPage()
  ' create the page grid
    page.AddRowsM(1,True, 10,  3, "rowtheme").AddCellsOSMP(1,0,0,0,  4,4,4,  5 , 5, 0,0,"cnter").AddCellsOSMP(1,0,0,0,4,4,4,5 ,5,0,0,"cnter").AddCellsOSMP(1,0,0,0,4,4,4,5,5,0,0,"cnter")  'row 1
    page.AddRowsM(1,True, 15, 0,"").AddCells12(1, "cnter")  'row 2
    page.AddRowsM(1,True, 0,  0,"").AddCells12(1, "")  'row 3
    page.AddRows(8,True, "").AddCellsOSMP(2, 0 ,0, 0, 12,  12,  6, 0 , 0,   15,15,"")   ' row (4 * 8)
    page.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components
Then, after review, I need to insert (another) row 1 - (type/format) after row 2 (before row 3). It has 3 cells where row 3 has 1. If I don't change the numbering when adding components, I will get Cell(x) not found??? Can I use CellR(1) in this fashion and carry on and not insert the new row?

"Funky Cold Medina" grids...


Licensed User
Mixing is probably not such a good idea. It should work, but then you have to be very careful you do indeed update all the rows AFTER the newly added, just as you must do if you only use cell().

CellR() was added much further into the development of ABMaterial. I too still have pages that are using only Cell(). But once this was introduced, I always use cellR() in my new forms.


Well-Known Member
Licensed User
Just a thought...
It is not difficult to read B4X layout files: https://www.b4x.com/android/forum/t...s-files-to-json-and-vice-versa.41623/#content
Maybe you can create a set of custom controls and use B4J designer to create the layout.
I honestly think this library, its power, and everything wrapped around it could become a totally new product line like B4W. Take all the glue code, web sockets, java, etc.. and make it transparent in the background. Not seen to the user unless explicit.

Layout the page in Visual Designer, and then click/drop labels, buttons, controls, etc like normal. And define the controls and subroutines in the code as is with B4a/B4I. all the websocket stuff and glue code is generated in the background.

Something to think about.