Enabled Textfield and ReadOnly Not accepting cursor

I have a window with a textField that on Windows that doesn’t accept a cursor, or even SelectAll. I have no code which disables it or turns it to ReadOnly and they are set in the IDE so. I don’t get selectAll also.

The MouseDown code has Return True
The MouseUp is

me.SelectAll
Return

Suggestions?
This is a working Mac version of the window.

Edit: It will accept focus via Tabs

In windows, you only see the selection when the caret is in the control, as you’re not putting the caret in there, you don’t see the selection, but it is selected.

Do a Me.SetFocus after the Me.SelectAll

Edit: However, that should really be done on the MouseDown to keep somewhere near standard windows behavior.

So:

Function MouseDown(X As Integer, Y As Integer) Handles MouseDown as Boolean
  Me.SelectAll
  Me.SetFocus
  Return True
End Function

Edit2: For the pedants (got to love forum rules), to actually answer the original question, the Focus isn’t placed into the control because of the Return True in MouseDown, if you do that, you have to take care of all the actions that would have normally taken place on that control.

Thank you. I didn’t think I would have to do that. I looked over a piece of code and it wasn’t there.
However that answers why I’ve had problems with TextAreas.

1 Like

IIRC, that’s a difference between Mac and Windows. So, ideally, you’d keep the idea to use MouseUp on Mac.

MouseUp is better though. It gives the user the chance to change his mind and slide the mouse out of the control, before releasing it. I also ensure, e.g. for buttons, that I highlight the control until either MouseUp or MouseOut.

1 Like

Right; double-click is also done that way and is, IMO, preferable over the Windows implementation, for the same reason.