iOS Question Mass change of labels using map file

John Woodsmall

Active Member
Licensed User
I have this map file "en.map":
B4X:
Button1="Clearit"
Button12=OK - Birthday
Button14=Testimonials
Button2=Cancel
Button3=Clear
Button4=Sound - ON
DatePicker1=Date
General_info=General Info
Lable1=Person x >>
Lable3=                  An Entertainment Feature Of:  © Lifestyle Interactive Media - All Rights Reserved
Lable4=Person 2 >>
lblfirstdate=Tap to Enter 1st Person
lblseconddate=Tap to Enter 2nd Person
Read_Person1=Retrieve Person 1
Results=Results
Save_Person1=Save Person 1 as Default
Scores=Scores
Speek1=TAP This GOLD Text To Enter 1st Person By VOICE
Speek2=TAP This GOLD Text To Enter 2nd Person By VOICE
main.lable1=Hold Blue Button Above  to speak birth data (Sample: ... May 5, 1987) 
main.textview2=Check accuracy of BIRTHDATA:
main.lable2= After Correct Birth Date loads CLICK HERE TO GO BACK (to home)
I run this sub:
B4X:
Sub Table7_CellClick (Col As Int, Row As Int)
    Log("CellClick: " & Col & " , " & Row)
    rx = Row
    language_name = Table7.GetValue(0,Row)
    language_abv = Table7.GetValue(1,Row)
    'Msgbox ("Language=" & language_name & " " & language_abv," ")
    MapFileName = language_abv & ".map"
    Log ("Mapfile name=" & MapFileName)
   Dim m As Map = File.ReadMap(File.DirAssets, MapFileName)
   For Each v As View In Page1.RootPanel.GetAllViewsRecursive
      Log("--" & v & v.Tag)
     If v Is Label And v.Tag <> Null And m.ContainsKey(v.Tag) Then
       Dim lbl As Label = v
       lbl.Text = m.Get(v.Tag)
      Log("Lable text=" & lbl.Text)
     End If
    If v Is Button And v.Tag <> Null And m.ContainsKey(v.Tag) Then
       Dim bt As Button = v
       bt.Text = m.Get(v.Tag)
      Log("Button text=" & bt.Text)
      End If
    'If v Is ImageView And v.Tag <> Null And m.ContainsKey(v.Tag) Then
     '  Dim ve As ImageView = v
     '  ve.Text = m.Get(v.Tag)
    '  Log(ve.Text)
     'End If
   Next
End Sub
I am expecting to modify the labels and buttons in the app, but I get this trace in the log:
B4X:
--<B4IViewWrapper: <UIImageView: 0x166eca50; frame = (0 0; 320 1022.5); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x166ec990>>>
--<B4IViewWrapper: <UIImageView: 0x165bb8f0; frame = (0 0; 348.81 65.9911); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x165bb890>>>
--<B4IViewWrapper: <UIButton: 0x166ee110; frame = (185.718 309.215; 103.7 65.9911); clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0x165bd910>; layer = <CALayer: 0x165bbe40>>>
--<B4IViewWrapper: <UIButton: 0x165bdcb0; frame = (18.8546 310.158; 113.128 28.2819); clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0x165bee60>; layer = <CALayer: 0x165bda10>>>
--<B4IViewWrapper: <UIButton: 0x165bf220; frame = (9.4273 388.405; 122.555 29.2246); clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0x165c0330>; layer = <CALayer: 0x165bef60>>>
--<B4IViewWrapper: <UIButton: 0x165c06b0; frame = (148.951 388.405; 160.264 29.2246); clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0x165c1600>; layer = <CALayer: 0x165c03f0>>>
--<B4IViewWrapper: <UIDatePicker: 0x165c1760; frame = (9.42729 377.092; 282.819 160.264); clipsToBounds = YES; hidden = YES; layer = <CALayer: 0x165c3de0>>>
--<B4IViewWrapper: <UILabel: 0x16625590; frame = (72.5902 171.577; 179.119 28.2819); text = ' Tap to Enter 1st Person'; clipsToBounds = YES; gestureRecognizers = <NSArray: 0x16624760>; layer = <_UILabelLayer: 0x16625fb0>>>
--<B4IViewWrapper: <UIButton: 0x166242c0; frame = (0 381.806; 103.7 37.7092); clipsToBounds = YES; hidden = YES; opaque = NO; gestureRecognizers = <NSArray: 0x166235b0>; layer = <CALayer: 0x16624bb0>>>
--<B4IViewWrapper: <UILabel: 0x16623380; frame = (72.5902 244.167; 179.119 28.2819); text = ' Tap to Enter 2nd Person'; clipsToBounds = YES; gestureRecognizers = <NSArray: 0x166227f0>; layer = <_UILabelLayer: 0x16623490>>>
--<B4IViewWrapper: <UIButton: 0x16622350; frame = (207.401 379.92; 84.8457 37.7092); clipsToBounds = YES; hidden = YES; opaque = NO; gestureRecognizers = <NSArray: 0x16621680>; layer = <CALayer: 0x16622c50>>>
--<B4IViewWrapper: <UILabel: 0x16621450; frame = (6.59911 171.577; 103.7 28.2819); text = 'Person 1 >>'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x16621560>>>
--<B4IViewWrapper: <UILabel: 0x16620990; frame = (6.59911 244.167; 103.7 28.2819); text = 'Person 2 >>'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x1663a6c0>>>
--<B4IViewWrapper: <UIButton: 0x1661fdd0; frame = (150.837 278.105; 160.264 28.2819); clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0x1661f120>; layer = <CALayer: 0x16620170>>>
--<B4IViewWrapper: <UIButton: 0x1661ec60; frame = (7.54184 277.163; 131.982 28.2819); clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0x1661dfb0>; layer = <CALayer: 0x1661f000>>>
--<B4IViewWrapper: <UIButton: 0x1661daf0; frame = (263.964 172.52; 47.1365 28.2819); clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0x1661bcc0>; layer = <CALayer: 0x1661de90>>>
--<B4IViewWrapper: <UIButton: 0x1661b800; frame = (263.964 243.224; 47.1365 28.2819); clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0x1661ab50>; layer = <CALayer: 0x1661bba0>>>
--<B4IViewWrapper: <UIImageView: 0x1661a950; frame = (0 69.762; 95.2157 51.8501); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x1661aa30>>>
--<B4IViewWrapper: <UIImageView: 0x165f4a30; frame = (226.255 69.762; 94.273 51.8501); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x165f49e0>>>
--<B4IViewWrapper: <UIImageView: 0x16619890; frame = (95.2157 69.762; 131.982 51.8501); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x16619b10>>>
--<B4IViewWrapper: <UIImageView: 0x166186a0; frame = (10.37 460.995; 296.96 38.6519); clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0x165f69c0>; layer = <CALayer: 0x16620c60>>>
--<B4IViewWrapper: <UIButton: 0x165f6d30; frame = (18.8546 340.325; 113.128 28.2819); clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0x165f7bd0>; layer = <CALayer: 0x165f6aa0>>>
--<B4IViewWrapper: <UILabel: 0x165f7d10; frame = (10.37 421.4; 296.96 37.7092); text = '                   An Ent...'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x165f7cb0>>>
--<B4IViewWrapper: <UILabel: 0x165f88b0; frame = (329.955 490.219; 94.273 37.7092); text = ''; clipsToBounds = YES; gestureRecognizers = <NSArray: 0x165f94f0>; layer = <_UILabelLayer: 0x165f8830>>>
--<B4IViewWrapper: <UILabel: 0x165f95f0; frame = (9.42729 145.18; 304.916 18.8546); text = 'TAP This GOLD Text To Ent...'; clipsToBounds = YES; gestureRecognizers = <NSArray: 0x165579e0>; layer = <_UILabelLayer: 0x165f9570>>>
--<B4IViewWrapper: <UILabel: 0x165577f0; frame = (9.42729 213.057; 304.916 18.8546); text = 'TAP This GOLD Text To Ent...'; clipsToBounds = YES; gestureRecognizers = <NSArray: 0x165561c0>; layer = <_UILabelLayer: 0x16557900>>>
--<B4IViewWrapper: <UIButton: 0x16555d40; frame = (113.128 122.555; 113.128 18.8546); opaque = NO; gestureRecognizers = <NSArray: 0x16555090>; layer = <CALayer: 0x165560e0>>>
there are questions:
1.) why do it not work?
2.) why does it see: UIImageView ; when it is not asked for and how to avoid this.

thanks!
john
 

Erel

Administrator
Staff member
Licensed User
why do it not work?
1. Hard to say from this code snippet. You should create a small project and upload it (with the map file).
2. You are iterating over all views:
B4X:
For Each v As View In Page1.RootPanel.GetAllViewsRecursive
Log("--" & v & v.Tag)
You don't need to add quotes.
 
Top