Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to reset to default property for a class in all file
Message
From
23/08/2000 14:43:01
 
 
To
22/08/2000 13:44:05
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00407867
Message ID:
00408400
Views:
36
>How to reset to default property for a class in all forms & clases a given project

How about something like this for the forms. The first group of code here brings every form up in the form designer, calls a PRG and saves it.
lnForms = adir(aforms, 'forms\*.scx')
for lnX = 1 to lnFOrms
	modi form (aForms[lnX]) nowait
	aSelObj(aA, 1)
	loopthroughcontrols(aA[1])
	activate window 'form'
	keyboard '{ctrl + w}'
endfor
Now, this is where the ResetToDefault() it done, it loops throuhgh every control looking for "MyClass" and then Resets the "Caption" property.
*LoopThroughControls.PRG
lparameters loObject
local loControl, lcBaseClasses
lcBaseClasses = 'FORM GRID COLUMN CONTAINER CONTROL COMMANDGROUP OPTIONGROUP PAGE PAGEFRAME'

do case
	case type('loObject.ControlCount') = 'N'
		for each loControl in loObject.Controls
			if upper(loControl.Class) = 'MYCLASS'
				loControl.ResetToDefault('Caption')
			endif
			if upper(loControl.BaseClass) $ lcBaseClasses
				LoopTHroughControls(loControl)
			endif
		endfor

	case type('loObject.ButtonCount') = 'N'
		for each loControl in loObject.Buttons
			if upper(loControl.Class) = 'MYCLASS'
				loControl.ResetToDefault('Caption')
			endif
			if upper(loControl.BaseClass) $ lcBaseClasses
				LoopTHroughControls(loControl)
			endif
		endfor

	case type('loObject.PageCount') = 'N'
		for each loControl in loObject.Pages
			if upper(loControl.Class) = 'MYCLASS'
				loControl.ResetToDefault('Caption')
			endif
			if upper(loControl.BaseClass) $ lcBaseClasses
				LoopTHroughControls(loControl)
			endif
		endfor

	case type('loObject.ColumnCount') = 'N'
		for each loControl in loObject.Columns
			if upper(loControl.Class) = 'MYCLASS'
				loControl.ResetToDefault('Caption') = 'C'
			endif
			upper(if loControl.BaseClass) $ lcBaseClasses
				LoopTHroughControls(loControl)
			endif
		endfor
endcase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform