# 有 lostfocus , 无 getfocus

Posted by jutso on December 31, 1998 at 14:42:24:

我有一个 test 用的程式如下：

VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2520
ClientLeft = 48
ClientTop = 312
ClientWidth = 3744
LinkTopic = "Form1"
ScaleHeight = 2520
ScaleWidth = 3744
StartUpPosition = 3 '系统预设值
Begin VB.TextBox Text2
Height = 372
Left = 600
TabIndex = 1
Text = "Text2"
Top = 1080
Width = 2532
End
Begin VB.TextBox Text1
Height = 372
Left = 600
TabIndex = 0
Text = "Text1"
Top = 360
Width = 2532
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Text1_GotFocus()

Debug.Print "text1 getfocus"

End Sub

Private Sub Text1_LostFocus()

Debug.Print "text1 lostfocus"
MsgBox "text1 lost focus"
Text1.SetFocus
DoEvents

End Sub

Private Sub Text2_GotFocus()

Debug.Print "text2 getfocus"

End Sub

Private Sub Text2_LostFocus()

Debug.Print "text2 lostfocus"
MsgBox "text2 lost focus"
Text2.SetFocus
DoEvents

End Sub

执行后，点一下 text2，只是轮流出现 text1 lostfocus 跟 text2 lostfocus，
却都没出现 getfocus 事件，请问没有 getfocus ，怎么会有一大堆
lostfocus？

Follow Ups:

- Re: 有 lostfocus , 无 getfocus 洪扬 22:04:04 1/01/99 (0)
- Re: 有 lostfocus , 无 getfocus Nelson 15:19:13 12/31/98 (4)
  - Re: 有 lostfocus , 无 getfocus jutso 15:28:07 12/31/98 (3)
    - Re: 有 lostfocus , 无 getfocus Nelson 17:30:12 12/31/98 (2)
      - Re: 有 lostfocus , 无 getfocus jutso 05:30:03 1/01/99 (0)
      - Re: 有 lostfocus , 无 getfocus jutso 05:29:52 1/01/99 (0)
- Re: 有 lostfocus , 无 getfocus jutso 15:13:00 12/31/98 (0)