Re: Single Event Handle for Multiple Controls
Quote:
Originally Posted by greekgoddj
Well its safe to say now that ON_CONTROL_RANGE is not suitable to be used with ActiveX controls...
Are you sure it is? ;)
Quote:
so the new question is...What is? :)
I'm not sure about what exact thing you're trying to do, but I suppose you're trying to fire some event from AX depending on the fact some of the buttons were clicked, right? Well, for this purpose you have to have message map in your AX along with the ON_CONTROL_RANGE inside, and some event which must be fired on button clicking. Apparently AX event must pass some value related to ctrlID which was clicked. Having these all you just fire AX event from inside control range handler. Easy, ain't it?
Re: Single Event Handle for Multiple Controls
Did you ponder about the point that Igor made?
ON_CONTROL_RANGE macro works for pre-defined notifications from MFC controls. I doubt that it could be extended to handle events fired by your ActiveX controls (even if your ActiveX control is generated by MFC).
So your first approach seems quite the way i.e. using ON_EVENT in the EVENT SINK MAP
What you need is something like ON_EVENT_RANGE and it is precisely what is available.
Please see ON_EVENT_RANGE macro
Re: Single Event Handle for Multiple Controls
Quote:
What I meant to say is that I cannot/should not change the behaviour of the controls which are already being used in many places and different applications, just for them being used in one specific application.
Are you aware that through versioning, you can add new functionality to a control without breaking other applications that use the control? Modifying the controls seems like the best option here. Otherwise, you'll need to look into using Windows hooks to trap any messages. And, I'm not sure that will handle everything you want.
Re: Single Event Handle for Multiple Controls
Hi again,
The AX controls take care of events from mouse and keyboard and everything is fine with controls themselves. When the AX controls respond to those user events(or are they messages), the AX controls fire off custom events/messages. Now my application is using many of these AX controls and wish to capture the events fired from the AX controls.
The good news...It now works!!! What I needed was ON_EVENT_RANGE http://msdn.microsoft.com/library/de...vent_range.asp
:)
Thanks Igor and Mike!
Aristotel
Re: Single Event Handle for Multiple Controls
Ohh..I just posted that last post and THEN saw the recommendation of ON_EVENT_RANGE!! So yes guys..that was what I needed! Thanks Mitesh :)
Re: Single Event Handle for Multiple Controls
Hi greekgoddj,
if you have no issue then can u plz give me your code sample to handle all the db events of Axapta in my .net application.
It will really very much helpful to me.
Thanx in adavance.
Regards,
Ashlesh