Well I think I did find a solution to my problem which doesn't involve coding any GDI stuff to modify a textfield.
Instead, I'm using a textarea. You can change the background color of those, and if you make it small, and check to see the current text whenever it triggers an action event, you can keep it from displaying any unwanted characters or tabs or things.
I made this function to control the string:
; -----------------------------------------------------------------------------------------------------------------------------------
; This function returns a string that contains only the allowed characters, and of the allowed length.
; -----------------------------------------------------------------------------------------------------------------------------------
Function Allowed$(Txt$, MaxLen, AllowedChars$)
Local N
Local Char$
Local NewTxt$
; Scan through the input string, and create a new string that contains only those characters that are allowed in the string.
For N = 1 To Len(Txt$)
Char$ = Mid$(Txt$, N, 1)
If Instr(AllowedChars$, Char$) Then NewTxt$ = NewTxt$ + Char$
Next
; Truncate the string to the maximum allowed length.
NewTxt$ = Left$(NewTxt$, MAxLen)
Return NewTxt$
End Function
Oh, btw, that color function I added to the code archives had the red and blue functions backwards. I've fixed it now. You can blame that on microsoft. As usual, they've coded things backwards. I don't know what the hell is with them and making stuff work backwards. For example:
1. Instead of xRGB, the colors are stored xBGR.
2. Instead of having the x byte default to 1, which it will need to be if future expansion changes it to be an Alpha component, (which it seems likely it will), they require it to be 0, which would be fully transparent.
3. Bitmaps aren't stored in such a way that they are upside down in memory. And I'm not talking last byte first. I'm talking last line first. So the last byte of the image is at the end of the first line in memory.
What the hell were they thinking when they made these decisions? Especially the bitmap thing. It makes no sense.
They screwed up so many things with Windows it is amazing. They can't even get something like remembering the location of your icons, or your folder settings right.
I mean honestly. HOW HARD IT IS NOT TO TOUCH IT? All they have to do is DO NOTHING. Yet they chose to DO SOMETHING, and that something screws up the icons and folder settings at times.
God I hate Microsoft. :-)