Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to set a variable to a property?
Message
From
01/04/2021 05:32:19
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
01/04/2021 05:10:08
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01679404
Message ID:
01679418
Views:
54
>>UPDATE. In the debugger the value in the property PRE_FILTER is .F. So, basically, when using =cTest, VFP evaluates. But this is not what I wanted.
>
>Dmitry, are you defining the class in a Visual Class Library (*.vcx) or in a Program File (*.prg)?
>
>This is the effect you want, right?
>
>
>PUBLIC cTest AS String
>
>m.cTest = "IN_SERVICE = 'Y'"
>
>LOCAL DLI AS DL
>
>m.DLI = CREATEOBJECT("DL")
>
>? m.DLI.PRE_FILTER     && prints IN_SERVICE = 'Y'
>
>DEFINE CLASS DL AS Custom
>
>	PRE_FILTER = m.cTest
>
>ENDDEFINE
>
Are you sure the changes of the value of cTest would be propagated to the property? If it's assigned like this, the assignment happens only when the object is instantiated. Even creating a new object still contains the value as it was for the first instantiated object.
PUBLIC cTest AS String

m.cTest = "IN_SERVICE = 'Y'"

LOCAL DLI AS DL

m.DLI = CREATEOBJECT("DL")

? m.DLI.PRE_FILTER     && prints IN_SERVICE = 'Y'

m.cTest="out of service"

m.DL2 = CREATEOBJECT("DL")

? m.DL2.PRE_FILTER     && still prints  IN_SERVICE = 'Y'


DEFINE CLASS DL AS Custom

	PRE_FILTER = m.cTest

ENDDEFINE

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform