>>>Since hopefully we're all moving toward using subclasses to some extent, I think it's useful to say that you can also use a little loop like this:
>>
>>>FOR lnObject = 1 TO Form.ControlCount
>>> IF PROPER(Form.Controls[lnObject].BaseClass) = "Textbox"
>>> Form.Controls[lnObject].Enabled = .F.
>>> ENDIF
>>>ENDFOR
>>
>>
>> What about looping through pages in a pageframe, or textboxes nested inside a container class?
>
>To account for those, you'd vary the loop a little, nesting additional loops inside the outer loop for any containers found in the form. (Containers including pageframes.)
>
>Such as:
FOR lnObject = 1 TO Form.ControlCount
> DO CASE
> CASE PROPER(Form.Controls[lnObject].BaseClass) = "Textbox"
> Form.Controls[lnObject].Enabled = .F.
> CASE PROPER(Form.Controls[lnObject].BaseClass) = "Pageframe"
> FOR lnPage = 1 TO Form.Controls[lnObject].ControlCount
> FOR lnObj2 = 1 TO Form.Controls[lnObject].Controls[lnPage].ControlCount
> * Handle it.
> ENDFOR
> ENDFOR
> OTHERWISE
> ENDCASE
>ENDFOR
As you can see, that could get a little ugly, but I'm not sure it's uglier than hard-coding a bunch of calls to Form.SetAll(). Again, ugly is in the eye of the beholder.
>
>Cheers,
>Rich.
Before using code like this in more than a place or two, you should consider writing a custom form.DoSetAll (or something routine) that recognizes a container object in the controls collecitons and recurses back into itself to loop through the container's controls colleciton as well.
Erik Moore
Clientelligence