Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there an easy way to reset values on a form?
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00612159
Message ID:
00612202
Views:
25
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
Previous
Reply
Map
View

Click here to load this message in the networking platform