Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP6SP5 - Generic Loop-Thru-All-Controls code
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00792236
Message ID:
00792526
Vues:
16
Thanks Nadya that is a fine idea for initializing fields andcan be adapted. But in my case I wanted to check for a flag and empty value. If so I wanted to update a PRIVATE flag and a message string from a higher up function.

The function I posted required a few changes, specifically, needed check for Column baseclass, which would help in continuing the scan deeper.

Thanks for responding.

>See Forms & Form designer Re: Iterating through form's controls Thread #407951 Message #408311
>
>
>
>>Hi all
>>
>>Is there a fool-proof code which will loop through all control, irrespective of depth of controls. My code follows, but it does not seem to do all that well.
>>
>>Please advise
>>
>>THIS.MustHavesValidate(THIS)
>>
>>
>>LPARAMETER toControl
>>
>>
>>PRIVATE loControl, lnI, lnJ, lnK, lnL, lnM, lnS
>>
>>
>>loControl = toControl
>>
>>
>>DO CASE
>>	CASE loControl.BASECLASS$"Form"
>>		FOR lnI = 1 TO loControl.CONTROLCOUNT
>>			THIS.MustHavesValidate(loControl.CONTROLS(lnI))
>>		ENDFOR
>>	
>>
>>	CASE loControl.BASECLASS$"Pageframe"
>>		FOR lnJ = 1 TO loControl.PAGECOUNT
>>			WITH loControl.PAGES(lnJ)
>>				FOR lnK = 1 TO .CONTROLCOUNT
>>					THIS.MustHavesValidate(.CONTROLS(lnK))
>>				ENDFOR
>>			ENDWITH
>>		ENDFOR
>>
>>
>>	CASE loControl.BASECLASS$"Grid"
>>		FOR lnS = 1 TO loControl.COLUMNCOUNT
>>			WITH loControl
>>				THIS.MustHavesValidate(.COLUMNS(lnS))
>>			ENDWITH
>>		ENDFOR
>>
>>
>>	CASE loControl.BASECLASS$"Container"
>>		FOR lnL = 1 TO loControl.CONTROLCOUNT
>>			WITH loControl
>>				THIS.MustHavesValidate(.CONTROLS(lnL))
>>			ENDWITH
>>		ENDFOR
>>
>>
>>	CASE loControl.BASECLASS$"Commandgroup" OR loControl.BASECLASS$"Optiongroup"
>>		FOR lnM = 1 TO loControl.BUTTONCOUNT
>>			WITH loControl
>>				THIS.MustHavesValidate(.BUTTONS(lnM))
>>			ENDWITH
>>		ENDFOR
>>
>>
>>	CASE loControl.BASECLASS$"Checkbox" ;
>>			OR loControl.BASECLASS$"Combobox" ;
>>			OR loControl.BASECLASS$"Editbox" ;
>>			OR loControl.BASECLASS$"Listbox" ;
>>			OR loControl.BASECLASS$"Spinner" ;
>>			OR loControl.BASECLASS$"Textbox"
>>
>>		IF loControl.lMustKey AND EMPTY(loControl.VALUE)
>>			plRetVal   = .F.
>>			pcReqdFlds = pcReqdFlds + loControl.name + chr(13)
>>		ENDIF
>>ENDCASE
>>
>>
>>loControl = .NULL.
>>
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform