Here's everything I know about Xailer's Active X and OCX support to date. As
I learn more, I will post to this thread.
Hopefully this saves some of you some time at some point.
TOCX is the base class that all OCX controls inherit
OCX.lib is the libary you need to link in
cCLSID is the string reference to the OCX control installed
Examples :
// Xtreme Calendar Control
PROPERTY cCLSID INIT "Codejock.CalendarControl.10.4.2"
// Web Browser
PROPERTY cCLSID INIT "Shell.Explorer"
// Shockwave Flash Object
PROPERTY cCLSID INIT "ShockwaveFlash.ShockwaveFlash.1"
// Adobe Acrobat Control for ActiveX
PROPERTY cCLSID INIT "{CA8A9780-280D-11CF-A24D-444553540000}"
You use the Components->Import ActiveX to import a control, usually you get
a *.prg and a *.ch file created
To create an instance of a control you can do this
WITH OBJECT ::oOCXControl := TMyOCXCOntrol():New(::oForm1)
::nAlign := alClient //Makes the control fill the client window passed
into the New Method above
:Create()
END
You will get a hatched area in your control when the OCX cannot be
instantiated
There is a method that you can use to see if the OCX control you want is
installed , I cannot find it anywhere in the NG though. I'm sure Jose posted
such a thing
If you don't want the control to take over the entire form, you can you use
a panel like this
WITH OBJECT ::oOCXControl := TMyOCXCOntrol():New(::oPanel1)
::nAlign := alClient //Makes the control fill the panel control passed
into the New Method above
:Create()
END
EVENTS
When you create the OCX object you can assign methods to it's events like
this
WITH OBJECT ::oOCXControl := TMyOCXCOntrol():New(::oPanel1)
::nAlign := alClient //Makes the control fill the panel control passed
into the New Method above
:MoveUp := "MyMoveUpMethod"
:MoveDown := "MyMoveDownMethod"
:Create()
END
Some events are mapped back to the existing Xailer events, like Keydown for
example. If the OCX control event isn't firing, check the eqivilent Xailer
event, as it maybe mapped automatically
Eg, the control may have a KeyPress event, Xailer will map this to
"OnKeyDown"
Here's the list of known mappings
- nClrText
- nClrPane
- oFont
- OnClick
- OnDblClick
- OnKeyDown
- OnKeyUp
- OnLButtonDown
- OnMouseMove
- OnLButtonUp
Sometimes the OCX control will have objects that you can't easily create or
get to. For example the Codejock Calendar Control has a object called a
Calendar Resource. You cannot get to this via other objects. To get a
CalendarResource object you do this
::oCalendarResource := CreateObject( "CodeJock.CalendarResource.11.2.2" )
I have found that sometimes instead of an event passing an object, it just
passes a pointer (Valtype() returns P)
You can try this, it will create the object based on the pointer, it worked
in the codejock controls
oObj := TOleAuto():New( PointerToInt( pPointer ) )
You need this as well, as PointerToInt() doesn't exist.
#pragma BEGINDUMP
#include "windows.h"
#include "xailer.h"
XA_FUNC( POINTERTOINT )
{
hb_retnl( (long) hb_parptr( 1 ) );
}
#pragma ENDDUMP
Thats all I have so far.
Nick
In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
ActiveX and OCX Docs
-
- Mensajes: 328
- Registrado: Mar Nov 21, 2006 2:10 am