iOS Question Font Size not "Sticking"

MrKim

Well-Known Member
Licensed User
Longtime User
I have CLV I am using with CLVExpanable. I am loading a layout and then setting the Font Size of the a number of the labels. The labels are defined as B4Xviews and the text size is changed when each time a layout is loaded.
B4i 6.80

B4X:
Sub Class_Globals
'    Private fx As JFX
    Private lblTitle As B4XView
    Private Phone1Lbl As B4XView
    Private Phone2Lbl As B4XView
    Private EmailLbl As B4XView
.
.
.
Sub CreateItem(clr As Int, Data As Map, Pic As String, Flagged As String, Admin As Byte, ExpandedHeight As Int) As B4XView
    'D -Delete, S-Secretary, T-Treasurer, L-Literature, G-Group Rep
    Dim p As B4XView = MP.xui.CreatePanel(""), clr2 As Int = clr
    p.SetLayoutAnimated(0, 0, 0, MP.PhoneListCV.AsView.Width, ExpandedHeight)
    p.LoadLayout("Item")
    p.SetLayoutAnimated(0, 0, 0, p.Width, p.GetView(0).Height) 'resize it to the collapsed height
    lblTitle.TextSize = 25
    Phone1Lbl.TextSize = 25
    Phone2Lbl.TextSize = 25
    EmailLbl.TextSize = 25
.
.
.

This all works fine in B4A and B4J but in B4i as soon as it is finished loading and the code completes it reverts to the font size that is set in designer.

 

MrKim

Well-Known Member
Licensed User
Longtime User
do you have in you designer script: "AutoScaleAll"?
Yes
have you checked "Handle Resize"?
I don't know what "Handle Resize" is but I found something called "Adjust Font Size To Fit". I tried it checked and unchecked and it made no difference. In production mode both times.
 
Last edited:
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
I didn't know that, unlike B4J/A B4i will size to fit automatically. That suits my needs just fine. The reason I had an issue with setting the size in designer is I actually have code in B4/J that resizes the font if the text does not fit.
So much to learn!
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
AutoScaleAll

from my experience erel the "AutoScaleAll" fix the issue with font size. but without need to change it in runtime. so my suggestion put the right font size in the designer and keep AutoScaleAll. for me it fixes those issues.
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
from my experience erel the "AutoScaleAll" fix the issue with font size. but without need to change it in runtime. so my suggestion put the right font size in the designer and keep AutoScaleAll. for me it fixes those issues.
That is exactly what I did. The issue is that occasionally the text is too large so I am using MeasureTextWidth in J/A to reduce the size if it is too large. B4i takes care of that for you. Nice!
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
but without need to change it in runtime. so my suggestion put the right font size in the designer and keep AutoScaleAll. for me it fixes those issues.
Setting the correct font size with the designer is the best option. The commend about AutoScaleAll is only relevant if you want to modify it at runtime.
 
Upvote 0
Top