B4J Question [ABMaterial] How not to unwrap row content/fix component in a RC (RowCell)?

Mashiane

Expert
Licensed User
Longtime User
Hi there

I'm hoping I'm asking the right question. Well I have my screen that I need to have the JustGauge custom control on the side section of the screen. I have defined the screen to be 10x2 where I will put the JustGauge at 2,2. It seems like if there is no component on 1,1, the rows gets wrapped and thus my JustGauge seem to be sitting in 1,1, which is not what I want.

How do I ensure that my component sits on the right without the cell appearing to have wrapped the content?

I have attached herein the right look, this only shows when I have page.ShowGridInfo = True whilst the production version shows the JustGauge in the incorrect location.

Can someone please advise?

I have tried cell alignment and thought about putting a {NBSP} in 1,1 but that will create an unneccessary component for me.

RightScreen.png WrongScreen.png
 

mindful

Active Member
Licensed User
You need to use AddCellsOSMP .. so you can provide an offset for you 2nd cell ... i'm not at my pc right now so I can give you an example but it would be something like:
B4X:
Page.AddRowsM (1, False, 0, 0, "").AddCellsOSMP (1, 0, 0, 0, 10, 10, 10, 0, 0, 0, 0, "").AddCellsOSMP (1, 10, 10, 10, 2, 2, 2, 0, 0, 0, 0, "")
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
You need to use AddCellsOSMP .. so you can provide an offset for you 2nd cell ... i'm not at my pc right now so I can give you an example but it would be something like:
B4X:
Page.AddRowsM (1, False, 0, 0, "").AddCellsOSMP (1, 0, 0, 0, 10, 10, 10, 0, 0, 0, 0, "").AddCellsOSMP (1, 10, 10, 10, 2, 2, 2, 0, 0, 0, 0, "")
That sounds like a good idea. Eish, each time I need to think about the grid definitions first, I forget that.
 
Upvote 0

stanmiller

Active Member
Licensed User
Longtime User
I suspect you'll also need a ABM.CELL_ALIGN_RIGHT theme, but I would begin with Grid builder to help sort out the positioning.

For example, for row #2 you only need one content cell not two. You can push the content cell to the right of the page with an offset. In fact, you might want to start with an offset of 6 then use ABM.CELL_ALIGHT_RIGHT to shift the content the rest of the way. In other words, let the browser do the math. I've found if you set the offset too high (e.g. 10 or 11), you can get strange behavior like wrapping.

Also, instead of the gauge substitute an ABMLabel as you experiment. And remember to [CTRL][F5] to force a cache refresh as the align right might be present on disk, but the page stale in the browser.

ABM Gridbuilder

For row #2 we can specify an offset of 8 grid cells and that our single content cell span 4 grid cells.

1_abm_gridbuilder_offset2_zpscrojhb3r.jpg


ABM Gridbuilder generated code
B4X:
page.AddRows(1, True,"").AddCells12(1,"")
page.AddRows(1, True,"").AddCellsOS(1,8,8,8,4,4,4,"")
page.AddRows(1, True,"").AddCells12(1,"")
page.BuildGrid ' IMPORTANT!
 
Last edited:
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
I will see what the offset does. I tried the cell alignment it didnt do anything significant. I'm more confortable experimenting with the gauge as it will be the final component there after all. If however the offset has some strange behaviors perhaps having a placeholder ABMLabel is the way to go. I will try the 1 spanning cell and see what happens, I had thought the gauge would be small perhaps. Thanks...
 
Upvote 0
Top