Another Text Box...I need help...

Blitz3D Forums/Blitz3D Beginners Area/Another Text Box...I need help...

next: here is the new code;Not wrapping the text.
Function TextBox2(t$)
font = LoadFont("Blue Highway Bold",23,False,False,False)
SetFont font
Local textboximg = LoadImage("TextBox.bmp")
DrawImage textboximg,320,65
yy = 5
xx = 75
For i = 1 To Len(t$)
	char$ = Mid$(t$,i,1)
	If char$ = " "
		If StringWidth(Mid$(t$,i,16) + xx) > ImageWidth(textboximg) + 75
			yy = yy + 25
			xx = 75
		EndIf
	EndIf
	Text xx,yy,char$
	xx = xx + 10
Next
Flip
End Function


I have a feeling its because of this:
 
If StringWidth(Mid$(t$,i,16) + xx) > ImageWidth(textboximg) + 75

but that is all I could think of.
is there something else I could do to calculate it?