Can I check if a TextField got the focus? I know there is a Event GotFocus. Tried SelStart, but this is 0 even if the Cursor is in another TextField.
Maybe with something like this:
If (Me = Me.TrueWindow.Focus) Then
' RectControl has focus
See Window.Focus or ContainerControl.Focus
More precisely: I want to know if a TextField got the focus when I click on a button. Without the GotFocus event and a property if possible (awfully complicated solution).
I wonder why you do not want to use the gotfocus eventhandler … but anyway: In the buttons Action event you can cycle through the controls and evaluate vs. Window.Focus:
For i As Integer = 0 To Self.ControlCount - 1
If Self.Control(i) IsA RectControl Then
If Self.Focus=Control(i) Then
Solution from Oliver works! Thanks!
I do it like:
If textfield1 = textfield1.TrueWindow.Focus Then
MsgBox “got focus”
MsgBox “no focus”