>I didn't think this would work:
>
WITH oMyObj
> .SomeProperty=.T.
> SomeFunction()
> .AnotherProperty=.F.
>ENDWITH
> * ...more code in this procedure
>
>Function SomeFunction()
>.YetAnotherProperty=.T.
>Return
>
>If .YetAnotherProperty is a property of oMyObj in the calling code, this will resolve OK in the function SomeFunction. But I thought that WITH / ENDWITH only scoped to the current procedure. What's up?
Hullo Mark. Since SomeFunction is called within the with..endwith code block, its still scoped to the block .
tis a basic thing - always nasty on C++ exams .. same concept here with VFP.
IF YOU DID NOT include a call to SomeFunction inside your WITH block, then
you should see some failure when the function fires [if .YetAnotherProperty is not declared prior to calling function SomeFunction .
I don't see that as a bug or a limitation - that the way it was designed.
Some anology might be the concept of declaring a variable in a small codeblock, then using/calling/placing that variable in a report that was called from the codeblock. BUT ? If you are looking at the report in design mode and have no knowledge of the codeblock that generates the variables the report uses ? What you gonna do ? Basically those variables are in scope only during the running of the code block, which includes the call to the report run .
Scoping is fun . I've been bitten in the past with concept of 'this', but luckily the scars have healed over.
mondo regards [Bill]