Custom Call contents

I am populating a table with custom cells from a file with 4 fields which is working fine. If I click on a row how do I get the contents of the custom cell? ATM I am just using the row number to get it from the original array which is fine but if I add search fields to the table this won’t work

Var cell As MobileTableCellData = Table1.CreateCustomCell(GetTypeInfo(TeamCustomCell2))
Var container As TeamCustomCell2 = TeamCustomCell2(cell.Control)
container.CouncilLabel.Text = tempw(x).NthField(tab, 1)  
container.EmailLabel.Text = tempw(x).NthField(tab, 4)   
Table1.AddRow(0,cell)

In the selection changed event:

Var myCell As MobileTableCellData = Me.RowCellData(section, row)
Var customCell As TeamCustomCell2 = TeamCustomCell2(myCell.Control)
Var counciltext As String = customCell.CouncilLabel.Text
Var emailabeltext As String = customCell.EmailLabel.Text

I use methods inside custom cells to get and set information so I don’t have to worry about directly accessing a control. I’d use

Var counciltext As String = customCell.GetCouncil()

A better way is always separate representation from data
So fill you custom cell (better use a function like setData with the right data, the string tempw(x) in your case, and pass also a Tag, IE something you can use to retrive your original data)

On search you will create a result subset array use that to retrive the data you need to show
on selection changed you can simple ask for the cell tag

In any case is far better use a Datasource

2 Likes

Hi Mark,
I had the get and set methods in place but could get the syntax right. What I put below returned “”

Var cell As MobileTableCellData = Table1.CreateCustomCell(GetTypeInfo(TeamCustomCell2))
Var container As TeamCustomCell2 = TeamCustomCell2(cell.Control)
Var counciltext As String = container.EmailName()
DefaultEmailCouncil = tempwQLD(row).NthField(tab,1)

Screenshot 2023-11-18 at 8.56.22 am

What is your code in EmailName.Get?

Return EmailLabel.Text

Now working both ways… thanks Mark, next stop trying a Datasource :slight_smile:

1 Like