Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retaining the setting
Message
From
19/07/2007 20:46:56
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01242201
Message ID:
01242215
Views:
8
>The expresions for properties are only evaluated when class is instantiated for the first time and stored in the cached copy of the class. All class instances are created from that cached copy. As result they all have the same value of such properties.

Thanks for the info. That's the (one of) piece I didn't know.

>You should put code in the Init so it'll be evaluated for each instance.

That's what I had already done.

Thanks again

>
>>I have a form inside an application. In the Init of the form is
>>this.AddProperty('omySQLData',CREATEOBJECT('app_data_env_mySQL'))
>>
>>
Define Class App_Data_Env_mySQL As Custom
>>
>>	Dimension aUPDFieldNames[1]
>>	Dimension aUPDFieldValues[1]
>>
>>	cTableName = Space(0)
>>	cUPDCondition = Space(0)
>>	cTableOperation = Space(0)
>>	IsTest = VARTYPE(rlpIstest)="L" AND rlpIsTest
>>	ofrmBase = .Null.
>>
>>**--------------------------------------------------------------------
>>	Hidden Function Init() HelpString 'Does when the object is created'
>>
>>		This.ofrmBase = Createobject('frmBase')
>>                etc.
>>		Return .T.
>>
>>	Endfunc
>>
>>rlpIstest is public variable set in my test version of the calling program.
>>
>>I set the conditions such that rlpIstest is (say) true on the first iteration. I close the form and exit the application. I then change the conditions so rlpIstest should be false. When this class is re-instantiated the IsTest value is the same as in the first instance.
>>
>>In the Unload event of the form I have added
thisform.oMySqlData = .NULL.
but that doesn't seem to have helped. I resolved this issue by putting
this.IsTest = VARTYPE(rlpIstest)="L" AND rlpIsTest
in the init method of the class but I'm curious as to why it retains the original value the second time it is instantiated.
>>
>>Any insight appreciated..............Rich
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform