Bug? label text size not changed

Discussion in 'Bugs & wishlist' started by ArminKH, Aug 4, 2015.

  1. ArminKH

    ArminKH Well-Known Member

    hi
    when i change the label text size before a while loop the text size not changed
    !!!!!
    please test attached sample
     

    Attached Files:

  2. klaus

    klaus Expert Licensed User

    Adding DoEvents before the loop will do it.
     
    ArminKH likes this.
  3. ArminKH

    ArminKH Well-Known Member

    see this please
    this code works on some device and not worked on some device
     

    Attached Files:

    • sa.zip
      File size:
      33.2 KB
      Views:
      53
  4. klaus

    klaus Expert Licensed User

    That's a different code than the one you posted in post#1, I gave you a solution for that one.
    The behaviour may change with different Android versions.
     
    ArminKH likes this.
  5. ArminKH

    ArminKH Well-Known Member

    yes thank u
    but as you can see at the attached sample the text size not increased or decreased in a while loop even with DoEvents
     
    Last edited: Aug 4, 2015
  6. klaus

    klaus Expert Licensed User

    In the code you posted in post#3 there is no DoEvents.
    On my device your code displays nothing.
    Then I added two Logs in Activity_Create.
    Code:
    Sub Activity_Create(FirstTime As Boolean)
        
    'Do not forget to load the layout file created with the visual designer. For example:
        Activity.LoadLayout("Layout1")
        Label1.Typeface = 
    Typeface.LoadFromAssets("mitra.ttf")   
            
    Log(Label1.TextSize)
            
    Dim T8TextSize1 As T8TextSize
             T8TextSize1.Initialize
            T8TextSize1.SingleLineFitText(Label1 , 
    False)
    '        DoEvents
        Log(Label1.TextSize)
    End Sub
    Result: first value 14.57....
    Second value 0.1406...
    So it seems that your routine doesn't do what you expect.
     
    ArminKH likes this.
  7. ArminKH

    ArminKH Well-Known Member

    thank u klaus yes u are correct
    do you know why?
    because some time my getLineCount sub return 2 even if my text is 1 line(single line)
    and i have not any solution for this one
    as you can see this code of java not worked in that while loop and always return 0
    Code:
    Jo = TargetView
        
    Return Jo.RunMethod("getLineCount",Null)
    i ask this 3 or 4 days ago but i have not answered by good solution
    here is my thread about this problem
    http://www.b4x.com/android/forum/threads/get-line-count-of-a-label.56790/
    if is possible for u please correct me
    thank u for wasting your time for my crazy question
     
    mojako likes this.
  8. klaus

    klaus Expert Licensed User

    Sorry, but I cannot look at this problem before a week, I will be absent for 1 week since tomorrow.
     
    ArminKH likes this.
  9. ArminKH

    ArminKH Well-Known Member

    tnx
    i'm wait for u next week :D
     
  10. klaus

    klaus Expert Licensed User

    You got an answer in the other thread.
     
    ArminKH likes this.
  11. ArminKH

    ArminKH Well-Known Member

    please test attached project in post 3 thats not works even with do events when it is in a while loop
     
    Last edited: Aug 13, 2015
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice