Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to subclass an OCX control?
Message
De
08/06/2004 17:01:31
Larry Long
ProgRes (Programming Resources)
Georgie, États-Unis
 
 
À
08/06/2004 16:12:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00911164
Message ID:
00911394
Vues:
17
This message has been marked as the solution to the initial question of the thread.
Hey guys, I found the answer...

1) I define my custom methods in my procedure file....

DEFINE CLASS myCustomClass AS OLEPUBLIC
*NOTE: Do not declare the OLECLASS here!
PROC TypeLibMethod1
ENDPROC

PROC TypeLibMethod2
ENDPROC
ENDDEFINE

2) Then in my form...
thisform.NewObject('FormObjectName','myCustomClass','Path/ProcFile',,'TypeLib')

It appears as if this is more of an overlay than a subclass. Anyway I think that this will fit the bill.

Thanks for all your help


>Look the VFP8 Help File, DEFINE CLASS there example
>
>
>   PUBLIC frmOLETest
>   frmOLETest = CREATEOBJECT('Form')
>   frmOLETest.Visible = .T.
>
>   frmOLETest.ADDOBJECT('OCXTest', 'BlueOLEControl', ;
>      'MSOutl.Outline')
>   frmOLETest.OCXTest.AddItem('Item One')
>   frmOLETest.OCXTest.AddItem('Item Two')
>
>   DEFINE CLASS BlueOLEControl AS OLEControl
>
>      * Set a property of the ActiveX control
>      .Object.Backcolor = 16776960
>
>      * Set properties of the OLE Container Control
>      Visible = .T.
>      Height = 100
>      Width = 200
>   ENDDEFINE
>
>
>
>>When I use mscomctllib.listviewctrl.2 (per your example) it does the same thing.
>>
>>Can you verify?
>>
>>This is what I have
>>
>>*AMADDON.PRG
>>DEFINE CLASS myListView as olecontrol
>> OleClass = 'mscomctllib.listviewctrl.2'
>>ENDDEFINE
>>
>>Create a form and drop a command button on it.
>>In the click method, I have
>>
>>thisform.NewObject('test','myListView','amaddon.fxp')
>>
>>
>>>DId you verify OleClass value for this control?
>>>
>>>>When I issue "this.NewObject('objectname','classname','procname')" in the form's init, the Activex dialog pops up prompting me to select a control.
>>>>
>>>>Any idea as to what is happening?
>>>>
>>>>>
>>>>>What error do you get? Try to drop ActiveX on a form and read OLECLASS property.
>>>>>
L.A.Long
ProgRes
lalong1@charter.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform