FormatTextAreaText - Poss bug/odd behavior
BlitzMax Forums/MaxGUI Module/FormatTextAreaText - Poss bug/odd behavior
| ||
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 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 |
| ||
Just been doing some more tests and it seems to be when you try and format whitespace. There then is a bleed into text that is added after the whitespace. i.e you write "hello " then format all 6 characters to output in red. you then write "World" afterwards and without any formatting so it should appear in black but it does not it is output in red. It would be nice for the doc's to mention such behavior :D it would save a bit of a headache when it comes to debugging. Cheers Cheers |