Author | Topic: InitClass and XbpActiveXControl | |
---|---|---|
Jimmy Yiu | InitClass and XbpActiveXControl on Tue, 07 Apr 2009 15:59:13 +0200 hi, > Example: > > CLASS Test > PROTECTED: > CLASS VAR oControl > EXPORTED: > INLINE CLASS METHOD InitClass() > (...) > RETURN self > > INLINE CLASS METHOD Init() > Work-around > IF Empty(::oControl) > ::oControl := XbpActiveXControl():New(...) > ::oControl:CLSID := "MyControl.12" > ::oControl:Create() > ENDIF > RETURN self Yes, this will work work, but it does not match what i need while it does work with "only one" activeX. What i need are a "global" activex in initClass for all "other" activeX follow in "Class Test FROM ActivexObject. a Sample for this a Tabpage from MsComCtl.OCX i need ImageList activeX, which hold Icon, as "global" in InitClass for TabStrip (Tabpage) activeX. *** code *** CLASS METHOD MSTabpage:INITCLASS() ::lFirst := .T. try "direct" MsComCtl.OCX ImageList as activeX -> FAIL * ::oImgList := XbpActiveXControl():new(, , {0,0}, {0,0} ) * ::oImgList:CLSID := "{2C247F23-8591-11D1-B16A-00C0F0283628}" * ::oImgList:CLSID := "MSComctlLib.ImageListCtrl.2" * ::oImgList:License := "9368265E-85FE-11d1-8BE3-0000F8754DA1" * ::oImgList:create() try "direct" MsComCtl.OCX ImageList as CreateObject -> FAIL while no :License ? * ::oImgList := CreateObject("MSComctlLib.ImageListCtrl.2") use Alaska "build-in" XPPSYS.DLL Imagelist (from XbpToolbar) Source c:\Alaska\XPPW32\source\SYS\activex.prg ::oImgList := ImageList():create() IF NIL == ::oImgList MSGBOX("can not create ImageList") QUIT ENDIF RETURN self METHOD MSTabpage:init( oParent, oOwner, aPos, aSize, aPP, lVisible ) DEFAULT oParent TO AppDesktop(), ; aPos TO {72,64}, ; aSize TO {800,600}, ; lVisible TO .F. ::XbpActiveXControl:Init(oParent, oOwner, aPos, aSize) * ::XbpActiveXControl():new(, , {0,0}, {640,480} ) * ::CLSID := "{1EFB6596-857C-11D1-B16A-00C0F0283628}" ::CLSID := "MSComctlLib.TabStrip.2" ::License := "9368265E-85FE-11d1-8BE3-0000F8754DA1" ::TabStop := .T. ::nIndex := 0 ::aBody := {} ::LastIndex := 1 RETURN self METHOD MSTabpage:create( oParent, oOwner, aPos, aSize, aPP, lVisible ) ::XbpActiveXControl:create() subscript Event ::DefEvent() RETURN self METHOD MSTabpage:add(pvIndex, pvKey, pvCaption, pvImage) *** eof *** greetings by OHR Jimmy MS_TABPAGE.JPG |