Android Question use lbl_Test from main/designer in class module

me68

Member
Licensed User
Longtime User
Hello!

I built a class module with Google Maps features to encapsulate all the data and functions there.

Now i'm not able to address a label defined in designer and available in main module.

How can i address this label?


Martin
 

me68

Member
Licensed User
Longtime User
Hello Erel!

Thanks - i used a copy of the label first, but this does not work.

Now i build a list in main and pass it to the class to store the list there. Then i can reference all the views i need.

Thanks.


Martin

B4X:
lMainLabels.Initialize
    lMainLabels.Add(lbl_MapsDistance)
    lMainLabels.Add(lbl_StatusbarInfo)
    lMainLabels.Add(lbl_SummarySpeed)
    lMainLabels.Add(lbl_SummaryOdo)
    lMainLabels.Add(lbl_SummaryNr3)

B4X:
    mMaps.InitLayout(lMainPanels, lMainLabels, lMainButtons)

class Maps:

B4X:
lPanels.Initialize
    lLabels.Initialize
    lButtons.Initialize
    lPanels = lMainPanels
    lLabels = lMainLabels
    lButtons = lMainButtons

B4X:
GetButton("btn_MapsRoad").Visible = False

with a little helper:

B4X:
Sub GetButton(sTag As String) As Button
    Return GetView(sTag, lButtons)
End Sub

Sub GetView(sTag As String, lList As List) As View
    Dim vCurrent As View
    For j = 0 To lList.Size - 1
        vCurrent = lList.Get(j)
        If vCurrent.Tag = sTag Then
            Return vCurrent
        End If
    Next
  
    Return Null
End Sub
 
Upvote 0
Top