B4J Question Getnode as button

Fabrice La

Active Member
Licensed User
Longtime User
Hi

This is my code
B4X:
Dim ligne As Int = 8
    For y = 0 To 7
        For i = 0 To frm.RootPane.NumberOfNodes - 1
            If frm.RootPane.GetNode(i) Is Button  Then
                Dim str As String = frm.RootPane.GetNode(i).Tag 'a8 a7
                If str = Chr(rg+97) & (ligne) Then
                    Dim bt As Button = frm.RootPane.GetNode(i)
                    bt.Initialize("")
                    bt.Text = col.SubString2(y,y+1)
                    ligne = ligne - 1
                    Exit
                End If
            End If
        Next
    Next

I don't have any error but when the form shows the button 's text is still empty the part "bt.Text = col.SubString2(y,y+1)" seems not working
 

DonManfred

Expert
Licensed User
Longtime User
Just a guess/what i would try

B4X:
Dim ligne As Int = 8
    For y = 0 To 7
        For i = 0 To frm.RootPane.NumberOfNodes - 1
            If frm.RootPane.GetNode(i) Is Button  Then
                Dim bt As Button = frm.RootPane.GetNode(i) ' Move the btn to this place. DO NOT initialize the button.
                Dim str As String = bt.Tag 'a8 a7  NOTE to get the Tag from the Button, not from the view you get from frm.RootPane.GetNode(i)
                If str = Chr(rg+97) & (ligne) Then
                    bt.Text = col.SubString2(y,y+1)
                    ligne = ligne - 1
                    Exit
                End If
            End If
        Next
    Next
 
Last edited:
Upvote 0
Top