Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there an easy way to reset values on a form?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00612159
Message ID:
00612202
Vues:
26
I have solved this problem by create objectvaluereset precedure in the parent form class


In the first parameters 'kimlik_exp, yayin_exp, abone, sira', I'm sending the object name alias to the procedure. For example instead of "thisform.kimlik_exp" only "kimlik_exp" is sent

The second logical paremeter is used for focusing on the form.
thisform.objectvaluereset('kimlik_exp, yayin_exp, abone, sira', .T.)


******************************
** thisform.objectvaluereset
******************************
lparameters cFieldsStr, lSetfocus

lparameters cFieldsStr, lSetfocus

local cField

= alines(aFieldsStr, chrtran(cFieldsStr,',', chr(13)+chr(10)))

for ii=1 to alen(aFieldsStr)
	cField = alltrim(aFieldsStr(ii))
	if empty(cField)
		loop	
	endif

	oObject = thisform.fieldNameToObject(cField)
		
	if vartype(oObject)='O'
		do case 
		case vartype(oObject.value) = 'C'
			oObject.value = ''
			if vartype(oObject.id) = 'N'
				oObject.id = ''
			endif
		case vartype(oObject.value) = 'N'
			oObject.value = 0
		case vartype(oObject.value) = 'D'
			oObject.value = {..}
		endcase	
	endif
	
	if ii=1 and lSetfocus = .T.
		oObject.setfocus()
	endif
endfor
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform