Code Module and Label

Vincenzo

Member
Licensed User
Longtime User
hi,
You can keep the reference of a label in a "Code Module"?

if I try:

sub Process_Globals
Dim Lab As Label
end Sub

Configure Sub (L As Label)
Lab = L
end Sub


I get an error:

Error compiling program.
Error Description: Can not access object from sub Process_Globals activity.
 

klaus

Expert
Licensed User
Longtime User
You cannot declare views in Sub Process_Globals !
They must be declared in Sub Globals.
In your case:
B4X:
Sub Globals
     Dim Lab As Label
End Sub
If you have a code module Config with a routine:
B4X:
Sub SetText(lbl as Label, txt as String)
    lbl.Text = txt
End Sub
You can call it from the main module and transmit the label as a parameter:
B4X:
Config.SetText(Lab, "Test")
Best regards.
 
Upvote 0
Top