Boundless textfield

My System: M1 Mac mini, 512G SSD, MacOS 14.2.1, Xojo 2023r4, dglamet4@gmail.com

I am working on a desktop App.

Upon opening, my app presents a window. The window contains a canvas and the canvas contains a textfield. The problem I describe happens with a textfield, a desktoptextfield and with a desktoptextarea. The textfield is a fixed width.

I want the following behavior: all visible characters, when typed, should be added to the text of the textfield. For example, although the textfield may be long enough to only show 5 m’s, when I type “hello world” I want the whole of the phrase to be stored in the text of the textfield.

What currently happens is that as I type visible characters, they fill up the textfield until they reach the right side of the textfield, at which moment the text in the textfield becomes selected (the background turns blue.) Upon typing the next character, the blue field is erased and only that next character remains.

In the keydown event of the textfield I have the following code:
KeyDown(key as string) as boolean
Var asc as integer = ASC(key)
if (ask >= 32) then
return false // the textfield handles the character?
end if
// act on a control character and

return true // I handled the character?

The only other events that are implemented are MouseDown and Mouseup.

Thanking you all in advance, I would appreciate any help you can give so as to achieve the
desired behavior for this textfield, that is, accumulating all typed characters instead of erasing the text when it fills the field.

From the Inspector, this textfield is initialized with
default text alignment
no spell checking
maximum characters = 0

I don’t think that, what you descripbe here, will reproduce the behavoir. Show us a sample project.

For starters, you should be testing for Asc(key)>31 because the space character is ASCII code 32. Perhaps you should post the actual code you’re using in TextField.KeyDown, because that’s probably where the issue is.