Android Question Panel.Height: Release -> Ok, Debug -> not ok

KMatle

Expert
Licensed User
Longtime User
In a lot of my apps I use a Scrollview and put views dynamically on it. Today I've found a strange behaviour (B4A 4.30). Maybe I'm blind, but...

In release mode the panel's height is adjusted correctly (tested on 2 devices), in debug (both modes), it will not change (stays at 1000dip). Any ideas?


B4X:
CMSsv.Initialize2(1000dip,"CMSsv") 
Activity.AddView(CMSsv,0,0,100%x,100%y)

later

B4X:
toppos=1%y
        For i = eArtikel To lArtikel
           
            Artikel=ArtikelListe.get(i)
            filen=Artikel.Get("ImageFile")
         
            Dim ueb As Label
            ueb.Initialize("")
            ueb.Text=Artikel.Get("Ueberschrift")
            ueb.Gravity=Gravity.CENTER
            ueb.Color=Colors.DarkGray
            ueb.TextColor=Colors.ARGB(255,255,165,0)
            CMSsv.Panel.AddView(ueb,5%x,toppos,90%x,5%y)
            SetLabelTextSize(ueb,ueb.Text)
           
            toppos=toppos+5%y
            Dim ueb2 As Label
            ueb2.Initialize("")
            ueb2.Text=Artikel.Get("OnlineAb") & "  " & i & " (" & Artikel.Get("Autor") &")"
            ueb2.Gravity=Gravity.left
            ueb2.Color=Colors.DarkGray
            ueb2.TextColor=Colors.ARGB(255,255,165,0)
            CMSsv.Panel.AddView(ueb2,5%x,toppos,90%x,3%y)
            SetLabelTextSize(ueb2,ueb2.Text)
           
            toppos=toppos+4%y
            Dim im As ImageView
            im.Initialize("")
            im.Bitmap=LoadBitmap(mypath ,filen)
            im.Gravity=Gravity.CENTER
            CMSsv.Panel.AddView(im,5%x,toppos,44%x,30%y)
            Log(im.Width)
            Log(im.height)
           
            Dim te As Label
            te.Initialize("")
            te.Text=Artikel.Get("AText")
            te.Color=Colors.DarkGray
            te.TextColor=Colors.ARGB(255,255,165,0)
            CMSsv.Panel.AddView(te,50%x,toppos,45%x,30%y)
            SetLabelTextSize(te,te.Text)
                   
            toppos=toppos+32%y
       
        Next
        CMSsv.Panel.Height=toppos
 

KMatle

Expert
Licensed User
Longtime User
The reason for this behaviour is setting a breakpoint. I can reproduce it.

B4X:
      toppos=toppos+32%y
       
        Next
        
--->>>>>   CMSsv.Panel.Height=toppos
   
   
        Log("Panel height: " &CMSsv.Panel.Height)
        Log("CMSSV height: " &CMSsv.Height)

Setting it to "CMSsv.Panel.Height=toppos" seems to skip the line -> heigth not set

So it's clear why it works in Release and not in Debug.

@Erel : Is is a bug?
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
Yes. It works (but adding code for debugging is not that comfortable)

Without the code:

-> Release: Everything is fine
-> Debug + with breakpoint at the same line which adjusts the height: Doesn't work
-> Debug + no breakpoint at the same line which adjusts the height: Everything is fine

Does the debugger prevent it?

Easiest solution: No breakpoint at the line which adjusts the panel's height.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Confusius once said... "if you know where the troubles are... why not just avoid them"?

Well... maybe it was not confusius ...
 
Upvote 0
Top