Hi, I have been trying to use FormatTextAreaText to Highlight values when outputted to a TextArea if the meet search criteria (the program is a lottery number checker.)
I have an odd problem tho of more than the matched numbers are highlighted, quite often till the end of the line, although the debug logs report that the vars for cursor position and length are what they should be a lot more of the text is highlighted. Using debuglog I have checked when the highlight is being applied an it is only when a match has occoured.
I have removed the function in question and built a test shell. This is below.
This exhibits the same bug. However if I add -1 to the end of the length parameter of Formattextareatext then it works as it should. Run the examples below to see what I mean.
Non Working Code
Working code
Any suggestions, or is it a bug with BlitzMax Gui
Thanks
I have an odd problem tho of more than the matched numbers are highlighted, quite often till the end of the line, although the debug logs report that the vars for cursor position and length are what they should be a lot more of the text is highlighted. Using debuglog I have checked when the highlight is being applied an it is only when a match has occoured.
I have removed the function in question and built a test shell. This is below.
This exhibits the same bug. However if I add -1 to the end of the length parameter of Formattextareatext then it works as it should. Run the examples below to see what I mean.
Non Working Code
Local win : TGadget = CreateWindow("test" , 0 , 0 , 640 , 480) Local outputbox : TGadget = CreateTextArea(0 , 0 , 640 , 480 , win) Local tout$ Local cursorpos : Long For Local i : Int = 1 To 1000 If i < 10 tout$ = "000" + i Else If i < 100 tout$ = "00" + i Else If i < 1000 tout$ = "0" + i End If If i Mod 10 = 0 tout$ :+ "~n" Else tout$ :+ " " End If If i Mod 5 = 0 cursorpos = TextAreaCursor(outputbox) ' capture cursor position AddTextAreaText(outputbox , tout$) FormatTextAreaText(outputbox, 255,0,0,TEXTFORMAT_BOLD,cursorpos, tout$.length) Else AddTextAreaText(outputbox , tout$) End If Next AddTextAreaText(outputbox , "~n") While WaitEvent() If EventID() = EVENT_WINDOWCLOSE Then Exit Wend
Working code
Local win : TGadget = CreateWindow("test" , 0 , 0 , 640 , 480) Local outputbox : TGadget = CreateTextArea(0 , 0 , 640 , 480 , win) Local tout$ Local cursorpos : Long For Local i : Int = 1 To 1000 If i < 10 tout$ = "000" + i Else If i < 100 tout$ = "00" + i Else If i < 1000 tout$ = "0" + i End If If i Mod 10 = 0 tout$ :+ "~n" Else tout$ :+ " " End If If i Mod 5 = 0 cursorpos = TextAreaCursor(outputbox) ' capture cursor position AddTextAreaText(outputbox , tout$) FormatTextAreaText(outputbox, 255,0,0,TEXTFORMAT_BOLD,cursorpos, tout$.length-1) Else AddTextAreaText(outputbox , tout$) End If Next AddTextAreaText(outputbox , "~n") While WaitEvent() If EventID() = EVENT_WINDOWCLOSE Then Exit Wend
Any suggestions, or is it a bug with BlitzMax Gui
Thanks