Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DLL Question
Message
De
08/09/1999 13:21:23
 
 
À
08/09/1999 12:31:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Divers
Thread ID:
00262172
Message ID:
00262473
Vues:
16
>>Your idea of using properties of the object and binding them
>>to the form objects is interesting.
>>
>>If I bound the form objects in the property sheet at design
>>time, then set up the DLL in the init, won't that error out
>>when the form's objects try to init?
>
>The trick here is that the COM must be instanciated before the controls. You can do that by dropping the COM on your form (go to Tools|Options|Controls, select ActiveX controls and check your COM. In the form toolbar, select ActiveX Controls and drop the COM on your form). Now, click on your COM and select Format|Send to Back to make sure that it will be the first object instanciated on your form.
>

Are you sure about this? Though ActiveX controls are COM objects, COM objects are not ActiveX controls unless they have a visual interface. While you can add a VFP created COM object to your available ActiveX controls, you can choose them from the list using their GUID, if you attempt to drop one on a form, you should get an error, because VFP servers don't support the COM interface that allows the controls to be dropped on a form. You can do this with VB though.

I think the solution to the form control binding problem lies in instanciating the control at run time. It must be done in the form load to make sure it happens before the controls themselves are instanciated. The server must be referenced by a form property instead of ADDOBJECTed to the form, because again, a VFP form is not a valid container for a VFP COM object


But this discussion makes me uncomfortable. If this class is only being used in VFP why all the trouble to make it work as a COM server? What's the point? Are slower programs better? Why can't you take the same exact class you created a COM server from, and drop it on a form as a VFP object?



>>And even more,would you consider trying to automatically add
>>the properties to the data object during it's init - that way
>>if the structure changes you dont have to go back in and modify it?
>
>>When to object is initialized, during run time, you could loop through
>>the fields and add a property for each field.
>
>That is a very good idea. I would create a property for the name of the table to read. The Init() would open the table specified in this property and create a property for each field of the table.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform