Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with initial value of property
Message
From
26/09/2012 11:12:09
 
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01553671
Message ID:
01553677
Views:
113
Likes (1)
Peter --

By design.

FoxPro does neat things with caching classes you have referenced so it does not have to re-create them from
scratch every time you use them.

This is the same problem experienced in VCX-based classes where the property value is created with an '=',
which is executed the first time the class is created only.

>Hi all,
>
>In the code hereunder the nStart property is set to the value of seconds() at the moment of creating the object. However, if I create another instance of the object (while the first is still active) the property does not get the value of seconds() of the moment of creation, but appears to be totally equal to the property of the first instance!
>
>I imagine I can get around this by redeclaring it in the Init(). But why is this happening? Another bug or 'just' a quirck? Or is it by-design??
>
>
DEFINE CLASS cusLogFileHandler AS custom
>	
>	nHandle    = 0
>	nErrors    = 0
>	dStart     = date()		&& start date - required for calculation of elapsed time
>	nStart     = seconds()
>	cFileName  = ""
>
>	PROCEDURE init( tcFileName, tlNew )
>		local lcWhat
>
>		with this
>			*
>
Jim Nelson
Newbury Park, CA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform