B4J Question B4XTable owner of a B4XTableColumn

LucaMs

Expert
Licensed User
Longtime User
"Strange" question.

I wrote a Sub (a method) to which I pass an object of type B4XTableColumn. I "must" color the cell borders of this column with the same color as the table, B4XTable's GridColor property (restore the color).
I can do this by passing the B4XTable to the method as well, but the question is as follows:

Is it possible to get the B4XTable that owns the passed B4XTableColumn, perhaps using reflection?

It's not clear to me which objects reflection can be used on in B4J (and B4A).


[B4XTable, as you know, has a public List variable (columns) that contains B4XTableColumn custom type objects]
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Call this once for each table:
B4X:
Private Sub SetCLVTag (Table As B4XTable)
    Table.clvData.AsView.Tag = Table
End Sub

And you will be able to get the table with:
B4X:
Private Sub GetTableFromColumn (c As B4XTableColumn) As B4XTable
    Dim p As B4XView = c.Panel
    Do While p.IsInitialized
        If p.Tag Is B4XTable Then Return p.Tag
        p = p.Parent
    Loop
    Return Null
End Sub
 
Upvote 0
Top