Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where to put form validation code?
Message
De
21/04/2004 05:22:40
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00896491
Message ID:
00896771
Vues:
15
David, you see the problem only into a specific ACTIVATE/DEACTIVATE.

The Problem is:
- With your code, i can change values into other Form with current Form into semimodal
- The event GotFocus into other Form is fired, without LostFocus
- I can put a status variable and check it into Gotfocus for ignore the event,
but on VFP exists bugs where When control and Form GotFocus occurs before Activate event.
DEFINE CLASS form1 AS form

	Top = 0
	Left = 0
	Height = 100
	Width = 300
	DoCreate = .T.
	Caption = "Form1"
	lsemimodal = .F. && -- lSemiModal - this form is running in semi-modal mode
	Name = "Form1"

	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 20, ;
		Left = 23, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Command1", ;
		Name = "Command1"

	ADD OBJECT check1 AS checkbox WITH ;
		Top = 25, ;
		Left = 151, ;
		Height = 17, ;
		Width = 86, ;
		AutoSize = .T., ;
		Caption = "Semi-modal", ;
		ControlSource = "thisform.lSemiModal", ;
		Name = "Check1"

	PROCEDURE Deactivate
		debugout program()
		if ( this.lSemiModal )
		   * pull focus back to this form
		   this.command1.SetFocus()
		endif
	ENDPROC

	PROCEDURE Activate
		debugout program()
	ENDPROC

	PROCEDURE GotFocus
		debugout program()
	ENDPROC

	PROCEDURE LostFocus
		debugout program()
	ENDPROC

	
	PROCEDURE Load
		activate window "debug output"
		this.Name = sys(2015)
		this.Caption = this.Name
	ENDPROC

ENDDEFINE
It is obvious that if I use 1000 variable ones of state in order to chase all the possible sequences of the events, considering the RETURN F. that they block to the When/Valid and the NODEFAULT that block the LostFocus, < b>perhaps it is possible to block all the undesired operations that VFP executes.


David,
with two forms with the current form into semimodal,
i can found a event sequence that it succeeds to violate the test code that you insert
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform