B4J Question [ABMaterial] abmbutton in the abmtable

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi
I have lot of buttons in the table. How could i detect which button click ?

B4X:
Dim btn1 As ABMButton
btn1.InitializeFloating(page, "view"&n1, "mdi-action-visibility", "sub3")
btn1.Size=ABM.BUTTONSIZE_SMALL
list.Add(btn1)
 

Harris

Expert
Licensed User
Longtime User
Something like this....

B4X:
 Sub   tblcases_clicked( PassedRowsAndColumns As List)

    Dim SelectedRowId As String
  
    Dim cn As ABMContainer = page.Component("cnt1")  ' the container that holds the table
  
    Dim tblCellInfo As ABMTableCell = PassedRowsAndColumns.Get(0) ' the passed data from the table
    Dim tblCases As ABMTable =  cn.Component("tblcases")' tblCellInfo.TableName)  'the table from container
  
    SelectedRowId = tblCases.GetString(tblCellInfo.Row,  0)  ' get the ID (pk) of the record selected
  
  
    If tblCellInfo.Column = 4 Then  ' if the column clicked was your button (or other control, button, checkbox, or just the row)
       Toast(" Edit Zone: "&SelectedRowId,3000)  
       ABMGentiZonesEdit(SelectedRowId)  ' call a method to open the associated modal sheet, passing the ID of the record since you may have more fields to fetch
       Return
    End If

End Sub
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
btn1.Size=ABM.BUTTONSIZE_SMALL
I did not know that this existed!

I was looking at your example and thought you shrunk the image.
This will help put more rows on a page since the button size (generally) sets the row height. Cool...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…