ActiveX components in Citect

IainH

Member
Join Date
Jul 2008
Location
Sussex
Posts
44
I need to use an ActiveX component to give an embedded display of streaming video from a number of remote IP cameras.

This is working well - up until the time when I want to display a number of thumbnail images and click on one to select it for viewing in a larger window.

My problem is, the ActiveX component traps all mouse activity so that Citect doesn't recieve any mouse down or up events (not even when the component is grouped with a "normal" graphics object).

The ActiveX component does have OnMouseKeyDown and OnMouseKeyUp events, but how can I recieve them in Cicode?

There appears to be a clue in the documentation for the SetEvent() function which states that "event types 128 - 256 are available for user defined events", but I cannot find how to define one.

Any ideas?

Thanks,

Iain
 
Well, it appears that I was on a wild goose chase with the SetEvent function.

The answer lies hidden in the documentation for the CreateControlObject() function which gives an example of creating an instance of an ActiveX object at run time and also creating an event handler for it.

The same technique can be used for an event handler for an object placed on the page at design time.

In its simplest form:-

FUNCTION EventClass_Event(OBJECT This [,<parameters>],...])
! Insert code to perform on event
END

EventClass is found on the object Properties/Access/Identification tab of the object.

Event is the name of the event in the ActiveX object. The available events are usually listed in the Properties/Appearance/Tag Association tab of the object.

The parameter OBJECT This is required and can be used in the handler to retrieve data from the ActiveX object. The additional parameters are required if the ActiveX object event provides them.

In my case, I was trying to capture the OnMouseKeyUp() event which is specified as:

OnMouseKeyUp(INT Btn, INT X, INT Y)

These parameters give the mouse key and the coordinates for the event.

My function delaration was:

FUNCTION PageTest_AN5_OnMouseKeyUp(OBJECT This, INT Btn, INT X, INT Y)
! Process the event
END

The code can be made more useable by using the following code:

ObjectAssociateEvents("ObjectName", ObjectByName("AN5"))

And the function declaration is now:

FUNCTION ObjectName_OnMouseKeyUp(OBJECT This, INT Btn, INT X, INT Y)

Hope this helps anybody with a similar problem.

Iain
 
What language did you use to create the ActiveX component?
I use C# or VB6, but am unable to expose the methods / events to Citect. If you know the methods exist, you can easily call them, but they don't appear in the Citect known methods list. Same for the events, while the events don't even get fired...
 
Hi Magnus, progress is progress and I now find myself writing my own ActiveX components using VB6.

I am interested in your comment "while the events don't even get fired..." as I am also having problems.

Are you saying that the ActiveX event is not being seen by Citect when raised or that Citect is not recognising the event at compilation when creating the event handler? (as I am finding)

Iain
 
Hi Ianh,

When I use an out-of-the-box ActiveX component, and I place that component somewhere on a page, then all events are listed in the opening window. Events in my ActiveX are not shown there.

We moved on to C# a while ago, but I haven't been able to accomplish it in both C# and VB6.
 
I have created a simple ActiveX component which encapsulates a WinSock control to transmit/recieve messages over Ethernet. I have done it this way as the actual transmitted block structure requires that null bytes are valid in the header of the data packet - something I could not do within Citect!

So, the intention is that Citect calls a Send method passing INT and STRING variables and my component creates and sends the packet data (as Bytes). This is working fine.

However, when recieving packets, and parsing them in the component, I want to raise an event and read the data extracted from the packet. I can see the Events at design time in the drop down list for Tag Association, but so far I have been unable to compile an event handler in the same way as for "Off the Shelf" components.

Iain
 
That is exactly how I have programmed my events. I did not do anything knowingly to get them into the drop-down list - but it may be worth checking again yourself as they were not visible until the list was dropped, i.e. the ListItem had not been initialised.

Thank you for the link, I shall read it for clues.

Iain
 
It must be one of those days :whistle:

I retyped my event handler in Citect and changed the name of one of the parameters I was using in the definition. The handler now compiles AND the event is recognised. :geek:

I still don't fully understand what went wrong, but hey, it is now working and if it still works tomorrow I won't let it worry me too much. :D

Iain

(The next challenge will be to get tags linked to properties and updating on events 📚)
 
Did you just create a usercontrol in VB6?
And did you alter any project settings regarding compiling (for COM visibilty oder etwas)?

Good for you that your events do get listed. Maybe I have to try again from scratch.

Regardless of VB6, I still haven't been able to make any C# events visible in Citect. And that is what I would really want.
 

Similar Topics

I am trying to display a .pdf file from within RSView32 using the ‘Adobe Acrobat Control for ActiveX’ without success. I have successfully used...
Replies
10
Views
6,959
Good day All, I am getting Error 1 when I try to open trends on my client. I tried to resolve the problem by creating .cab files but that did not...
Replies
2
Views
1,550
I'm testing the ability to make a custom ActiveX control for PVP7 applications to be able to write data out in an XML format. With my simple...
Replies
1
Views
712
I found a list of activex controls in view studio for which I simply cannot find any information on online. I don't know what they do. For example...
Replies
1
Views
986
Hey all, First post! I am trying to embed a web browser into my application to enable us to watch live feed of our AXIS IP Camera. The problem is...
Replies
0
Views
939
Back
Top Bottom