This is on 2020 r1.0
For the longest I’ve been working on Mac, but I switched to PC for various reasons.
All of a sudden I’m getting a crash when I HAVE changed TextAreas from ReadOnly = True to False and then redo the ReadOnly = True.
This is the first of the controls, and this is the line it crashes on.
CREdit(kCForWd).ReadOnly = True //If True, the text cannot be modified.
I have a routine which sets the controls to off, and it happens in this routine.
This routine is called a lot because I have to verify the controls are off. Yup I could probably figure another but that is later.
By the time it gets to this problem, the controls have been reset to off umpteen times without crashing.
It happens on the second time but only after the controls have been set
CREdit(kCForWd).ReadOnly = False
Suggestions?
Edit I tried to run this under 2019 r3.2 and got an error of StyleRun FontName not recognized. I ran an earlier version without that and it worked and worked under 2020 r1.
Do you get an exception or a crash?
No it just crashes. I also haven’t Built it and will do that soon, so I don’t know if it’s just the debugger.
I also suspect this is somehow related to the size of the app.
Sorry, I didn’t post code before, but here it is:
The Prm stuff are markers character sets that indicate Bold
//orgStrg As String, ffWin As BWindowClas, tstArea As TextArea, indx As Integer, shwDaggers As Boolean
Var fSize, pEnd, mvL, mvR As Integer //The fontsize that is larger than SizeOfFontMin
Var styRuns(), styTRun As StyleRun
//vR are identifying areas in SelectedText. mvL and mvR are for identifying for Mid removal
//vR is end of StyledText
//ptVal is only for testing
//Var str As String
Var ccBoole, LchgBoole As Boolean//
If App.Window(0) isa CardReview Then
LchgBoole = CardReview.LineHasChanged
ccBoole = CardReview.Changed
End If//If App.Window(0) isa CardReview Then//for Changed start Boolean
//sty
tstArea.Value = ""
fSize = ffWin.BfSize(indx)
mvL = orgStrg.IndexOf(Prm0L)
mvR = orgStrg.IndexOf(Prm0R) + Prm0R.Length
pEnd = orgStrg.IndexOf(EOL)
If mvL = -1 Then
styTRun = New StyleRun
If pEnd = -1 Then
styTRun.Text = orgStrg
Else
styTRun.Text = orgStrg.Left(pEnd+1)
End If
styTRun.FontSize = fSize
styTRun.FontName = DispFont
styRuns.AddRow styTRun
ElseIf mvL > -1 Then
If mvL > 0 Then//before Prm0L
styTRun = New StyleRun
styTRun.Text = orgStrg.Left(mvL)
styTRun.FontSize = fSize
styTRun.FontName = DispFont
styRuns.AddRow styTRun
End If
//start of Prm0L to Prm0R
styTRun = New StyleRun
styTRun.Text = orgStrg.Middle( mvL, mvR-mvL )
styTRun.FontSize = fSize
styTRun.FontName = DispFont
styTRun.Underline = True
styTRun.Bold = True
If False = shwDaggers Then
styTRun.Text = styTRun.Text.Replace( Prm0L, "" )
styTRun.Text = styTRun.Text.Replace( Prm0R, "" )
End If
styRuns.AddRow styTRun
//Before
//AT Prm0R
//After
styTRun = New StyleRun
If pEnd = -1 Then
styTRun.Text = orgStrg.Middle(mvR)
Else
styTRun.Text = orgStrg.Middle( mvR, pEnd-mvR+1 )
End If
styTRun.FontName = DispFont
styTRun.FontSize = fSize
styRuns.AddRow styTRun
End If//If mvL = -1 Then
If pEnd > -1 Then
styTRun = New StyleRun
styTRun.Text = orgStrg.Middle(pEnd+1)
styTRun.FontName = DispFont
If indx = kCHmWd Then
styTRun.FontSize = SizeOfFontMin
ElseIf indx <> kCHmWd Then
styTRun.FontSize = fSize
End If
styRuns.AddRow styTRun
End If//If ptVal > -1 Then
Var i As Integer
For i = 0 To styRuns.LastRowIndex
tstArea.StyledText.AddStyleRun styRuns(i)
Next
//end of sty