Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding ActiveX control to a form
Message
De
28/06/2009 08:05:58
 
 
À
27/06/2009 23:28:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Divers
Thread ID:
01408828
Message ID:
01408865
Vues:
54
I am trying to add a activex control GarXface.ocx to a form. I have tried dragging it from the component gallery and this does not work.

There are several ways of adding an ActiveX control in either of the visual designers. First you can drop an instance of the OLEContainer control base class on to the design surface. This will pop up a dialog that allows you to specify the control you wish to use. Simply ensure that the ‘Insert Control’ option is selected and click the ‘OK’ button to create the control.

Alternatively you can use the ‘Controls’ tab of Visual FoxPro’s options dialog to view, and select from, a list of all registered controls. (This subset can be made persistent by clicking the ‘Set As Default’ button). To access these controls select the ‘ActiveX Controls’ option from the controls toolbar in the appropriate designer. You can now select any of the controls you have previously specified and drop it directly on to your design surface.

Finally, you can create an instance of an ActiveX control programmatically. All that is needed is to add an instance of the OLEControl base class and set its OleClass property to point to the required control or, if you are using the AddObject() method, you can pass the ActiveX control name as a parameter, like this:
*** To add the Status Bar ActiveX Control to a form
WITH ThisForm
  .AddObject( 'oAX', 'olecontrol', 'MSComctlLib.sBarCtrl' )
  WITH .oAX
    WITH .Panels(1)
      .TEXT = "Sample Text"
      .TOOLTIPTEXT = "Panel 1"
      .STYLE = 0
    ENDWITH
    .Height = 25
    .Visible = .T.
  ENDWITH
ENDWITH
One benefit of doing this programmatically at run time is that you can utilize the VersionIndependentProgID and so avoid some of the versioning issues associated with using the visual designers.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform