Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Elusive problem
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01251169
Message ID:
01251238
Vues:
16
>Naomi,
>
>Glad to hear. You know, I was about to suggest you to take a look at WriteBuffer for I was sure there was a bug there



Hugo,

Hard to say if it was really a bug or not. The idea of WriteBuffer is to make sure that the current data are always saved. So if you just typed something and then press x at the right corner or Exit button on the toolbar, it has to behave the same. In my case I partially saved it with alltrim and the x started to behave, but then Exit button still gave me the message.

So, based on the previous code I've taken from UT threads, I made the following code to be my current:

LOCAL loColumn, loActiveControl, loControl, llRetVal

llRetVal = .T.
IF TYPE('Thisform.ActiveControl.Name' ) = 'C'
	loActiveControl = THISFORM.ACTIVECONTROL
	IF UPPER(m.loActiveControl.BASECLASS ) # 'GRID'
*** If there is code in the valid method of the active control
*** And the entry is invalid, the error message will display
*** But the rest of the code code will continue to run and save
*** the bad data anyway. So we cannot just issue a SetFocus()
		IF PEMSTATUS(m.loActiveControl, 'value', 5)
           	
			IF NOT EMPTY( loActiveControl.VALID() )
*** We still have to cause the Valid to fire to update the data
*** from what is in the buffer because the previous line
*** does not cause the Valid to fire, it merely runs any code
*** in that method		
				
				llRetVal = .T.
			ELSE
				llRetVal = .F.
			ENDIF
			IF NOT EMPTY(m.loActiveControl.ControlSource) ;
AND EVALUATE(m.loActiveControl.ControlSource) <> m.loActiveControl.value	
				loActiveControl.value = m.loActiveControl.value		    
			endif	
			loActiveControl.SETFOCUS()
		endif

	ELSE
		FOR EACH loColumn IN loActiveControl.COLUMNS
			IF loActiveControl.ACTIVECOLUMN = loColumn.COLUMNORDER
				loControl = EVALUATE( 'loColumn.'+ loColumn.CURRENTCONTROL )
				IF NOT EMPTY( loControl.VALID() )
					loControl.SETFOCUS()
					llRetVal = .T.
				ELSE
					llRetVal = .F.
				ENDIF
				EXIT
			ENDIF
		ENDFOR
	ENDIF
ENDIF

RETURN llRetVal
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform