Vertically Scrolling text with DoEvents

DoogieDog

Member
Licensed User
Longtime User
I am attempting to decipher Klauses excellant code. I want to be able to vertically scroll an edittext inside a scrollview. It works great on a existing file as you can get the length on entry. My question is how would this be accomplished on a new empty file, so that as you entered text you could fast scroll as the edittext.text got longer. I'm uncertain how the DoEvents is handeling this. Thanks
Doog

Heres Klauses Code
B4X:
Sub SetText
   Dim ht As Float
   
   lblText.Text = txt               ' set the text string to the Label text property
   ht =    StrUtil.MeasureMultilineTextHeight(lblText, txt)   ' measure Label height
   scvText.Panel.Height = ht      ' set the ScrollView internal Panel height to the measured height
   lblText.Height = ht               ' set the Label height to the measured height

   scvText.ScrollPosition = 0   ' set the scroll position to the top of the text
   DoEvents                              ' needed to execute the previous line
End Sub
 

Informatix

Expert
Licensed User
Longtime User
I really don't understand where the problem is. If you add content to an EditText, it scrolls its inner content automatically (and you can set its SelectionStart property to the last position to be sure). Being inside a ScrollView does not change anything. Could you post an example ?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…