B4J Question [ABMaterial] Show materialboxed in table

Harris

Expert
Licensed User
Longtime User
How does one show a MaterialBoxed image when the image is contained in a table?

B4X:
public Sub BuildImagefixed(page As ABMPage, id As String, image As String, opacity As Double, Caption As String) As ABMImage
    Dim img As ABMImage
    img.Initialize(page, id, image,opacity)
    img.IsMaterialBoxed = True
    img.IsResponsive = True
    img.Caption = Caption
    img.SetFixedSize(160,120)
   
    Return img
End Sub


B4X:
' adding image to table
If File.Exists(Main.campicFolder,tblFields.GetValueAt(j)) Then
  rCellValues.Add( ABMShared.BuildImagefixed(page, "img"&j,  "../campics/"&tblFields.GetValueAt(j),1, "")  )
  rCellThemes.Add("nocolor")

  End If

Hovering over the table image will show the "icon to select", but the event is not raised to show the image full screen.. table row event is raised...

Thanks
 

alwaysbusy

Expert
Licensed User
Longtime User
It can't. Although I made it possible to add components in a cell of a table, it is only for display purposes. They cannot 'run' so to speak (no events, no javascript etc). Only components added directly to a cell do actually work.

Note: just for testing purposes. Can you try adding the image to an ABMContainer and then add this container to the cell and run an container.refresh() afterwards? It just may work... (or not)
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
Yea, I was thinking of that. Or...

Adding the image to another cell(i, 2) , and being a cell and not a table, it may raise the Materialbox event (of the image) when clicked on. (it is hard to visualize)

On another note:
I have the same issue when I add a ABMcheckbox to a ABMtable or ABMlist. I can't get the "checked" state when inside another component (I get everything else, like cb.text)

I also don't know how to iterate a ABMList since their is no "Size" property.
ie.
Dim ls as ABMList
' ls. add - Many items...
For i = ls.size - 1 ' no SIZE prop...
' do my stuff...
' however, I could not get the checked state from a checkbox item added to a ABMList...
Next

I shall keep screwing with it..

When we try and extend and expect, we find the "holes" in the framework.
This MUST be extremely difficult for you.

Thanks
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Yes, same goes for an ABMList. As for ABMlist not having a size property: This is because it can have subitems (collapsable) so size does not really mean something in this case.

You can keep track wit them in a list yourself in B4J with the return ids and then use the .item() property in the iteration. Something like:

B4X:
dim myList as List
List.Initialize
...

dim ls as ABMList
' ls.add item
' mylist.add( added item returnid )

for i = 0 to mylist.size -1
   dim chk as ABMCheckbox = ls.Item(mylist.get(i))  '<--- this may be a container 
   ' do your stuff
next

When we try and extend and expect, we find the "holes" in the framework.
This MUST be extremely difficult for you.
That is no problem! I rather have people question what I'm writing because sometimes (not often ;)), I'm wrong. It also provides me with future ideas that I'm not thinking of myself.
 
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi,Could you get checked state now ? I have this problem too. My checkbox put in a ABMTable.

version 2.51
 
Upvote 0
Top