Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Object to Cursor command?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00420504
Message ID:
00421833
Vues:
15
>>I'm using this to simply make an exact copy of an object's properties structure (either a class-type object like 'Relation',etc. or a structure-type class that SCATTER NAME... gives me). I'm just using CREATE CURSOR and then SCATTER NAME to get back an exact copy of the structure of the original object. I can then put that exact copy into whatever I need to (simple object reference, object array, etc.) and as many times as I need to. I'm probably taking a speed hit with creating the cursor but it's not big enough to worry about yet considering the problems with having extra object properties.
>>
>>- A Hilton
>
>Your object is a VFP data object so scatter name works great. I am receiving a C++ data object. In that case the scatter name command takes the active data table I am on and scatters it's properties, not my object.
>
>__Stephen


Ahh, I see the confusion now (I think <g>). I'm just using the SCATTER NAME... as a mechanism to create the copy. I'm not trying to make an object solely from the currently selected table/cursor. Here's an outline...

- I have an object in an array (ie aArray(1) = create('oObject')...etc.)
- I want to copy that object to several other dimensions of the array *BUT* I don't have access to the 'oObject' definition when I need to do this (ie on the other side of a client/server situation)
- I create a temporary cursor by walking the objects' properties and forming a 'Create Cursor....' statement that makes a cursor with the same property names, type and length that I need. (This is why I was wanting a native VFP ObjectToCursor or even a CopyObject command)
- I then SCATTER NAME... from that temp cursor to a temp object that is an exact copy of the PROPERTIES of the original object.
- From there I can dump the temp cursor and use the temp object to make copies where I need it.

I've only used this with native VFP objects (not C++ objects, structures, collections, etc.) but it works well in this situation. I suppose it could be modified to handle methods and events too but I have no need for that right now and won't investigate it till I need it.

- A Hilton
A Hilton
Software & Technology Development,
Programming & Business Process Consulting
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform