Sub Process_Globals
End Sub
Sub Globals
Dim lbl As Label
Dim cvs As Canvas
Dim dum As Bitmap
Dim pnl As Panel
Dim phn As Phone
Dim tf As Typeface
End Sub
Sub Activity_Create(FirstTime As Boolean)
tf=Typeface.CreateNew(Typeface.SERIF,Typeface.STYLE_NORMAL)
pnl.Initialize("")
activity.AddView(pnl,0,0,100%x,100%y)
pnl.Color=Colors.White
lbl.Initialize("")
pnl.AddView(lbl,0,0,pnl.Width,pnl.Height)
dum.InitializeMutable(60,60)
cvs.Initialize2(dum)
End Sub
Sub Activity_Resume
Dim f,h,w As Int
Dim txt As String
phn.SetScreenOrientation(0) ' landsape only
txt="Test"
f=Measure(txt,tf) ' find "max" text size to fit in panel's height
w=cvs.MeasureStringWidth(txt,tf,f)
h=cvs.MeasureStringHeight(txt,tf,f)
pnl.Width=w
lbl.TextSize=f
lbl.TextColor=Colors.Blue
lbl.Typeface=tf
lbl.Text=txt
lbl.Width=w
'lbl.Height=h '<==== if active: This will REDUCE text even more
lbl.Top=0
activity.Title=f & "-" & pnl.Height & "-" & lbl.Height & " - " & h
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Measure(Txt As String,Typ As Typeface) As Int
Dim h,t,p As Int
p=pnl.Height*3/4 ' using ALL of pnl.height will worsen situation
h=12
t=cvs.MeasureStringHeight(Txt,Typ,h)
Do While t<=p
h=h+1
t=cvs.MeasureStringHeight(Txt,Typ,h)
Loop
h=h-1
Return h
End Sub