Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SCATTER to Object how do I add more propertys?
Message
 
To
26/04/2002 09:07:04
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00649539
Message ID:
00649614
Views:
18
This message has been marked as a message which has helped to the initial question of the thread.
>It is often handy to use the SCATTER NAME command to scatter
>fields to an Object.
>
>However there are many occasions where I would like to add a new property(s) to the object created, but the object created has no addproperty method to cater for this.
>
>At present I do this in rather cumbersome way.
>
>ie
>
>If I need another property called Section I would do the following
>
>SELECT *,left(code,2) as section from myTable into cursor myCursor
>
>then
>
>SCATTER NAME oMyob
>
>Most of the collection objects I have looked at are a bit heavy for what I want and require the name of the field passed as a parameter to reference contents.
>
>I also dont seem to be able to do the following
>
>SCATTER NAME thisform.myproperty

Hi Mark,

>However I can make thisform.myproperty = to an object previously created by SCATTER NAME myObj so this is not much of a problem. GATHER NAME thisform.myproperty works fine.
>
>I have a sneaking suspicion I may be going about things the wrong way, can anyone tell me if there is an easier way of doing this sort of stuff.

The workaround with

SELECT *,left(code,2) as section from myTable into cursor myCursor

seems to be the righ way to what you want to do. It looks easier than to bring ADDPROP.DLL into picture.

I have no problems with SCATTER NAME thisform.myproperty in VFP 6.0 SP5. It works fine for me.
However, I experimented before with SCATTER NAME somecontrol.property for the form controls (I did it for my Grid DragDropper), and got the dangling reference problems while trying to close the form, even if I assign that property to NULL.
My suspicion was that SCATTER NAME in this case seemed to create some object for the SCATTERed record internally, and then connected it with the property. When I store NULL to the property, the original SCATTER NAME object (which name I don't know) still stays around and can be released only with CLEAR ALL which is not good.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform