Bug? label text size not changed

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
 

Attachments

  • label.zip
    31.8 KB · Views: 205

ArminKH

Well-Known Member
Adding DoEvents before the loop will do it.
see this please
this code works on some device and not worked on some device
 

Attachments

  • sa.zip
    33.2 KB · Views: 223

ArminKH

Well-Known Member
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.
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:

klaus

Expert
Licensed User
Longtime 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.
B4X:
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

Well-Known Member
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.
B4X:
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.
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
B4X:
    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
https://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
 
Top