Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subclass an ActiveX Control
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00409746
Message ID:
00409781
Vues:
27
>Can you subclass an ActiveX Control like the TreeView? I want to add some default code to the init and add some properties so it will resize with my resizable forms..
>
>
>Thanks

John,

You can sub-class it in code like this:
DEFINE CLASS MyTreeView AS OLECONTROL
  #INCLUDE TreeView.h
  
  .Object.Appearance = 1
  .Object.BorderStyle = 0
  .Object.Height = 185
  .Object.Indentation = 20
  .Object.LabelEdit = tvwManual
  .Object.Left = 12
  .Object.LineStyle = tvwTreeLines
  .Object.MousePointer = 0
  .Object.OLEDragMode = 0
  .Object.OLEDropMode = 0
  .Object.Style = tvwTreelinesPlusMinusPictureText
  .Object.Top = 12
  .Object.Width = 150
  .Object.HotTracking = .T.
  
  Height = 185
  Left = 12
  Top = 12
  Width = 150
  
  PROCEDURE Init
  
    * Your init code here
  ENDPROC

  PROCEDURE Click

    * Your click code here
  ENDPROC
ENDDEFINE
* Create it like this in the Form's Init
IF "6." $ VERSION()
  * vfp 6.0
  lctreeclass = "MSComctlLib.Treectrl.2"
ELSE
  * vfp 5.0
  lctreeclass = "COMCTL.Treectrl.1"
ENDIF
SET PROCEDURE TO MyTreeView
This.AddObject("ObjTree", "CTreeView", lctreeclass)
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform