'Class module
Sub Class_Globals
Dim lblDt As Label
'Dim fontExistence As Typeface = Typeface.LoadFromAssets("Existence-Light.otf")
Dim cd As CustomDialog
Dim myfont As Typeface
Public m_Reply As String
Dim sv As ScrollView
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize (Target As Object, EventName As String)
End Sub
Sub lbl_click
Dim lbl As Label
lbl=Sender
lblDt.Text=lbl.Text
'This scrollposition works well
sv.ScrollPosition=lbl.top
End Sub
public Sub ShowTimeDialog
myfont=Typeface.DEFAULT
Dim pnl As Panel
pnl.Initialize("pnl")
cd.AddView(pnl, 0, 0%y, 80%x,80%y)
lblDt.Initialize("lblDt")
lblDt.TextSize=48
lblDt.Color=Colors.RGB(0x21,0xC7,0x9A)
lblDt.TextColor=Colors.white
lblDt.Gravity=Gravity.CENTER
lblDt.Typeface=myfont
pnl.AddView(lblDt,0,0,pnl.Width,70dip)
Dim i As Int
Dim heightOfTimeLabel As Int=70dip
sv.Initialize(200%y)
pnl.AddView(sv,0,lblDt.Height,pnl.Width,pnl.Height-lblDt.Height)
Dim w As Int =pnl.Width/2
For i = 0 To 23
Dim lbl As Label 'Round Hour label
lbl.Initialize("lbl")
lbl.text = i & ":00"
lbl.TextSize = 48
lbl.Gravity=Gravity.RIGHT
lbl.Typeface=myfont
sv.Panel.AddView(lbl,0,i*heightOfTimeLabel,w,heightOfTimeLabel)
Dim lbl2 As Label 'Half hour label
lbl2.Initialize("lbl")
lbl2.text = i & ":30"
lbl2.TextSize = 48
lbl2.Gravity = Gravity.RIGHT
lbl2.TextColor = Colors.RGB(220,220,220)
lbl2.Typeface = myfont
sv.Panel.AddView(lbl2,w,i*heightOfTimeLabel,w,heightOfTimeLabel)
Next
sv.Panel.Height = 24*heightOfTimeLabel
'I want to scroll to this position but it does not work
'here is perhaps too early
sv.ScrollPosition=12*heightOfTimeLabel
DoEvents
cd.Show("Start Time", "OK", "", "" , Null)
'but it is too late here
End Sub