Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bug?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Titre:
Re: Bug?
Divers
Thread ID:
00129046
Message ID:
00129619
Vues:
29
>Yes, put your code in the LostFocus event. That will be called ONLY if you move to another control.
Cannot. Because the code in Valid that is executed to skip to next control after selecting an item of the combo box immediately.

More details, Please run the following code. Thanks.
PUBLIC oform1

oform1=CREATEOBJECT("form1")
oform1.Show()
RETURN

DEFINE CLASS form1 AS form

	Top = 0
	Left = 0
	Height = 267
	Width = 555
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"

	ADD OBJECT label1 AS label WITH ;
		Caption = "Combo1:", ;
		Height = 17, ;
		Left = 10, ;
		Top = 10, ;
		Width = 51, ;
		TabIndex = 0, ;
		Name = "Label1"

	ADD OBJECT combo1 AS combobox WITH ;
		RowSourceType = 1, ;
		RowSource = "Peter,Mary,David,Tom", ;
		Height = 23, ;
		Left = 10, ;
		Style = 2, ;
		TabIndex = 1, ;
		Top = 29, ;
		Width = 116, ;
		Name = "Combo1"

	ADD OBJECT label2 AS label WITH ;
		Caption = "Text1:", ;
		Height = 17, ;
		Left = 10, ;
		Top = 143, ;
		Width = 32, ;
		TabIndex = 0, ;
		Name = "Label2"

	ADD OBJECT text1 AS textbox WITH ;
		Height = 23, ;
		Left = 10, ;
		TabIndex = 2, ;
		Top = 162, ;
		Width = 95, ;
		Name = "Text1"

	ADD OBJECT label3 AS label WITH ;
		Caption = "Text2:", ;
		Height = 17, ;
		Left = 10, ;
		Top = 193, ;
		Width = 32, ;
		TabIndex = 0, ;
		Name = "Label3"

	ADD OBJECT text2 AS textbox WITH ;
		Height = 23, ;
		Left = 10, ;
		TabIndex = 3, ;
		Top = 212, ;
		Width = 95, ;
		Name = "Text2"

	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 227, ;
		Left = 235, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Exit", ;
		TabIndex = 4, ;
		Name = "Command1"

	ADD OBJECT edit1 AS editbox WITH ;
		Enabled = .F., ;
		Height = 129, ;
		Left = 133, ;
		TabIndex = 0, ;
		Top = 10, ;
		Width = 415, ;
		Name = "Edit1", ;
		Value = ;
			'1. Select an item from Combo1.' + CHR(13) + '2. Valid event of Combo1 is executed.' + CHR(13) + '3. Click a blank area of this form, Valid event of Combo1 is executed one more time.' + CHR(13) + CHR(13) + 'Code in Valid of Combo1:' + CHR(13) + "WAIT WINDOW 'Valid event of Combo1 has been executed.' TIMEOUT 1" + CHR(13) + 'RETURN 1'

	ADD OBJECT label4 AS label WITH ;
		Caption = "ActiveControl:", ;
		Height = 17, ;
		Left = 133, ;
		Top = 143, ;
		Width = 74, ;
		TabIndex = 0, ;
		Name = "Label4"

	ADD OBJECT text3 AS textbox WITH ;
		Enabled = .F., ;
		Height = 23, ;
		Left = 133, ;
		TabIndex = 0, ;
		Top = 162, ;
		Width = 95, ;
		Name = "Text3"

	PROCEDURE combo1.Valid
		WAIT WINDOW 'Valid event of Combo1 has been executed.' TIMEOUT 1
		RETURN 1
	ENDPROC

	PROCEDURE combo1.GotFocus
		THISFORM.Text3.Value = THIS.Name
	ENDPROC

	PROCEDURE text1.GotFocus
		THISFORM.Text3.Value = THIS.Name
	ENDPROC

	PROCEDURE text2.GotFocus
		THISFORM.Text3.Value = THIS.Name
	ENDPROC

	PROCEDURE command1.Click
		THISFORM.RELEASE
	ENDPROC

	PROCEDURE command1.GotFocus
		THISFORM.Text3.Value = THIS.Name
	ENDPROC

ENDDEFINE
KK
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform