DesktopTextField problems

I have several textfields in a window. I type something in - it is fine and looks normal. I type something in another textfield then go back to the first one. The text I entered before is all there but all selected and I cannot position the cursor. I have to re-type what was there before.

It is a project from about 8 years ago which I have been updating with all the latest nomenclature and deprecations. This problem was there from the beginning. I guess this is something so simple and basic, I’m going to kick myself (again).

This is on top of my head, I have not yet used DesktopTextField. Check to see if there is a property, it may not be in the Inspector, that set if all the text should be selected or not when entering the DesktopTextField.

Is it read only ?

I wish it were that simple.

Create a simple new project with a TextField and see what happens in the same situation.

Then, search (using the offending TextField name) all entries where you make change(s) to that TextField, and you will certainly found the cause of the behavior.

Know than when a TextField have the Focus, it select its contents w"by default”.

If you do not want that, in GotFocus (or whatever its new name is: FocusReceived Event), set the Cursor position:

When I open a new project and put two textfields in the window, they behave as I would expect. In other words nothing is selected when I go from one to the other.

In the ‘old’ project, putting SelectionStart = 1 in the FocusReceived event makes no difference - the text is still selected.

1 Like

So, you selected the contents by code… Search where you’ve done that.

I had Return True in the MouseDown event. Such a novice mistake. I apologise for my stupidity.