rajsiyer
Sep 17 2009, 06:25 AM
Hiya Fellas...
Wish somebody has a clue about this.. I'll thank him earnestly.
You see I have a few combo boxes(MSForms2.0 ComboBox) on a page in citect. At runtime, whenever a combobox is used and an item is selected from it a function must be called. If You look at the Identification tab on an activeX, it has a field for Event Class.
How does one make use of it to invoke functions???
The citect help does not go further than this
"Identification] Event Class Allocate a name for the event class of your ActiveX object (16 characters). You can then use this name to create a Cicode function to trap an event. "
I've been struggling with understanding this since last week. Wish somebody would bail me out and tell me what to do next!!
Regards, best wishes,
Raj S. Iyer
Noggin
Dec 14 2009, 11:53 AM
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)
rajsiyer
Dec 14 2009, 01:57 PM
Thanks Noggin,
What you have nicely explained is exactly what I had wished to know. It's been some time since that project has been completed. Actually I had bludgeoned my way through this issue by declaring hundreds of events in the Project editor.Not to mention the equal number of event handlers in Cicode. I was lucky that Citect could hold out without cracking up. Clearly making use of the object's event class is much better.
Wish you success and happiness
Raj S. Iyer
EarthedSolutions
Feb 3 2010, 07:16 PM
Hi,
I see you've solved your problem, but for the sake of others, finding this forum, was worth elaborating, while I have some spare time:
Take a look at the following for a working example:
Project: CSV_Example
Page: activeX
Object: CiMeterX.TechMeter
Double click the Meter Object, select the Appearance + Tag Association Tabs
Then Select Update Association on:
+ <Property change notification>
+ Ack
+Change
+Click
+ MouseDown
+ DblClick
Its also worth a look at controlling extra ActiveX properties (with both VBa and Cicode examples)
Project: CSV_Example
Page: CSV_CiVBa
Object: CiMeterX.TechMeter
Code: Double click on the Cicode page buttons to expose the _ObjectSetProperty() calls to modify the ActiveX object
Double click on theVBa page buttons to expose the Object.Property VBa assignments modify the ActiveX object
Ian Finlay
www.earthed.net.au
Using Citect since 1993
rajsiyer
Feb 7 2010, 09:40 AM
Thanks Ian,
I appreciate your taking interest and showing me what literally lies under my feet. In all of the wide help documentation in Citect, I'd not really seen the Example project. However, there's one more issue that I've not understood, ie why would the Citect client stop running at times when a query is run.
Click
HERE to know more of this issue I face. A Million thanks in advance.
Raj S. Iyer
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.