Hello
I have a little problem on show a label in a ScrollView i.e. I had to increase the width of the scroll Panel to see all text. Here the fragments:
...
Dim scvText As ScrollView
Dim lblText As Label
...
scvText.Initialize(250) ' initialize the Scrollview
Activity.AddView(scvText, 0, 280, 100%x, 100%y) ' add the Scrollview on the Activity
lblText.Initialize("") ' initialize the Label for the text, without an EventName
scvText.Panel.AddView(lblText, 0, 0 ,100%x, 100%y) ' add the Label on the ScrollView internal Panel
...
Sub SetText(txt As String)
Dim ht As Float
'lblText.TextSize = 12 ' set the Label text size
lblText.Text = txt ' set the text string to the Label text property
ht = StrUtil.MeasureMultilineTextHeight(lblText, txt) ' measure Label height
scvText.Panel.Height = ht * 1.3 ' set the ScrollView internal Panel height to the measured height
lblText.Height = ht ' set the Label height to the measured height
scvText.ScrollPosition = 0
End Sub
Where is my mistake?
Best regards
John Rossati
I have a little problem on show a label in a ScrollView i.e. I had to increase the width of the scroll Panel to see all text. Here the fragments:
...
Dim scvText As ScrollView
Dim lblText As Label
...
scvText.Initialize(250) ' initialize the Scrollview
Activity.AddView(scvText, 0, 280, 100%x, 100%y) ' add the Scrollview on the Activity
lblText.Initialize("") ' initialize the Label for the text, without an EventName
scvText.Panel.AddView(lblText, 0, 0 ,100%x, 100%y) ' add the Label on the ScrollView internal Panel
...
Sub SetText(txt As String)
Dim ht As Float
'lblText.TextSize = 12 ' set the Label text size
lblText.Text = txt ' set the text string to the Label text property
ht = StrUtil.MeasureMultilineTextHeight(lblText, txt) ' measure Label height
scvText.Panel.Height = ht * 1.3 ' set the ScrollView internal Panel height to the measured height
lblText.Height = ht ' set the Label height to the measured height
scvText.ScrollPosition = 0
End Sub
Where is my mistake?
Best regards
John Rossati