Just step through the controls on the form
using the controlcount and controls array properties,
which are part of every form.
Example:
* Assuming this code is run from a method
* called ChkClass_And_Name on the form itself.
*//PR: PROCEDURE ChkClass_And_Name
* PURPOSE Step through all controls
* on the form and if they meet
* the criteria we've set for
* being changed - change them.
procedure ChkClass_And_Name
with this
for i = 1 to .controlcount
do case
case .controls(i).class = "Label" .and. .IsInNameList(.controls(i).name)
.controls(i).forecolor = rgb(0,0,255)
case .controls(i).class = "Textbox" .and. .IsInNameList(.controls(i).name)
.controls(i).backcolor = rbg(255,255,255)
* Other case statements if needed
case ...
case ...
otherwise
* default action
endcase
next
endwith
endproc
*//FN: FUNCTION IsInNameList
* PURPOSE Determine if a controls name
* is in the list we want to manage
* This function pre-supposes you've setup an array
* that contains the names of the controls
* you want to change properties for.
* You could just as easily performed the test
* in the case statements of ChkClass_And_Name,
* but if the test gets more complicated it's
* best to separate it out into a function. Which
* of course keeps the code clean.
function IsInNameList(lcControlName)
local lbIsInList
lbIsInList = ascan(this.aControlNamesToChange,lcControlName) <> 0
return lbIsInList
endfunc
'We all must do the hard bits so when we get bit we know where to bite'
