Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can I create a new object from an object on a form?
Message
De
28/09/2005 14:03:06
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01054004
Message ID:
01054090
Vues:
18
>>I have made two slight modifications (debugging it). For testing I put it in the Click() of a checkbox, named myFirstObject. It works nicely, but indeed the methods and events are not copied.
>>
local lcClass, lcClasslib, lnI, luValue
>>lcClass = thisform.myFirstObject.class
>>lcClassLib = thisform.myFirstObject.classlibrary
>>* Create a new object of the same class
>>thisform.NewObject("mySecondObject",m.lcClass,m.lcClassLib)
>>=amembers(laProps,thisform.myFirstObject)
>>for lnI=1 to alen(laProps)
>>    if not inlist(lower(laProps[m.lnI]),'class','classlib','top','left','name')
>>    try
>>       luValue = getpem(thisform.myFirstObject, laProps[m.lnI])
>>       store m.luValue to ("thisform.mySecondObject." + laProps[m.lnI])
>>    catch
>>      =Messagebox(laProps[lnI]+" property is read-only")
>>    endtry
>>   endif
>>next
>>
>>
>So, it worked?! Great. In the inlist we need to change classlib to classlibrary then..
>
>With aMembers we can get events and properties. If we can get everything when we can write a script for creating a class, then instantiate an object of that class. So, it's possible, but as I said, it's more work involved, so I leave the exercise to the thread's originator.


Good idea. So Jim, there's work for you! :)
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform