I have a TextArea which displays large chunks of text from a db table and use various StyledText formatting in it to bold, underline, and bold-underline various parts. Flipping through some of the rows to display the next article from the table is showing different timing results between Mac and Windows. Mac seems flawless and picks up the styled text changes immediately. When testing on Windows, it appears to go through “phases” and takes maybe 2 seconds to fully display the changes. Is this the expected behavior? FWIW, my Mac is newer (about 2 years old) and hefty. Windows is win 10 and several years old (7+ years), so not sure if the user would experience this also on a newer Windows or an older Mac
Here’s what the code looks like. I’m sure there can be improvements since there are a couple of loops and maybe that’s the problem
'get text from db. topic title at top and centered
dim sql as String = "SELECT * FROM RDguide WHERE ID = '" + TopicIDs(TopIDArrayNum) + "'"
dim rs as RowSet = dbTests.SelectSQL(sql)
txtStyle.StyledText.Text = rs.Column("Topic").StringValue + EndOfLine + EndOfLine + rs.Column("Solution").StringValue
'set up styles
dim startPos, textLength as Integer
txtStyle.StyledText.FontName(0, txtStyle.Text.Length) = "Arial"
'title
txtStyle.StyledText.ParagraphTextAlignment(0) = TextAlignments.Center
startPos = txtStyle.StyledText.Paragraph(0).StartPosition
textLength = txtStyle.StyledText.Paragraph(0).Length
txtStyle.StyledText.Bold(startPos, textLength) = True
txtStyle.StyledText.Size(startPos, textLength) = 24
'main body
txtStyle.StyledText.Size(startPos + textLength, txtStyle.Text.Length - textLength) = 18
'find any headings to bold underline (ends with colon)
dim headingsUB() as String
headingsUB = rs.Column("HBoldUnderline").StringValue.Split("; ")
for i as Integer = 0 to headingsUB.LastIndex
dim position as Integer
position = txtStyle.Text.IndexOf(0, headingsUB(i))
if position >= 0 then
txtStyle.StyledText.Underline(position, headingsUB(i).Length) = true
txtStyle.StyledText.Bold(position, headingsUB(i).Length) = true
end if
next
'find any headings to underline (terms)
dim headingsU() as String
headingsU = rs.Column("HUnderline").StringValue.Split("; ")
for j as Integer = 0 to headingsU.LastIndex
dim position as Integer
position = txtStyle.Text.IndexOf(0, headingsU(j))
if position >= 9 then
txtStyle.StyledText.Underline(position, headingsU(j).Length) = true
end if
next